This question is more than 8 years old. Now, with CakePHP 4.1.x, I am wondering if this [annoying] restriction has been changed, so for example the programmer can instruct CakePHP to add a disabled field into the INSERT statement. I was studying the documentation but I didn't find anything.
What do I mean:
The table user_comments is referring with user_id the table users. The user_comments form has a drop-down control for user_id which offers the users.name entries for a selection.
For the "add" action the shown/pre-selected entry in the drop-down can be easily determined assigning the "default" option the id value existing in the users table. This is all done in the $this->Form->control() function.
But the pre-selected value for user_id in the drop-down must NOT be changed and is clearly needed in the INSERT statement.
Making the drop-down element readonly isn't a solution because its selection can be still changed. The only way to assure the selected item in the drop-down cannot be changed is to make it disabled. And this is now the problem, because a disabled control isn't included in the INSERT statement and the INSERT fails as the user_id field isn't in the entity and it's needed in the user_comments table.
I hope somebody understands what I want to express.
My question:
Does CakePHP >= 4.1 offer an option which includes disabled fields in the entity?
Is there a way the browser submits a disabled field?
Update:
As Greg pointed out, this has nothing to do with CakePHP so I updated my question.
