Writing a record to include a column you don't want the user to be able to edit

QuestionsWriting a record to include a column you don't want the user to be able to edit
Jim Brown asked 7 years ago

In a table "Bike" there is a field "Rider" which is used as a foreign key to a "Person" table. If the "Rider" column is not editable, and one tries to create a new record-the record will not create. If the "Rider" column is editable the new record is created.

The query will only present the bike list for a particular user id, not for all users. Therefore I don't want the user to be able to edit the "Rider" column because that would add a motorcycle potentially to some other user.

I guess what I am looking for is a way to make a column writable to the database without the user being able to edit the column. Is this possible?

2 Answers
Abu Ghufran answered 7 years ago

Closing this ticket with the comments of actual poster.

….

Never mind.
Fixed.

The bikes table was related to the person table. My first tries at creating a new entry were using a rider number in the bike table that did not exist in the person table.

Once I realized that and use a rider number that actually existed, new records were created.

Jim Brown

Abu Ghufran answered 7 years ago

You might need to make rider column as hidden & editable, with a default value of the actual logged in rider.
For defaults, you can refer docs.

Render as textbox with size 20, and initial value in textbox to 10

$col["editoptions"] = array("size"=>20, "value"=>'10');

Instead of 10, you can use session value of rider id.

PS: Please ignore last email, thought questions are same.

Your Answer

8 + 18 =

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!