i am trying to disable a field on update rules models but i am having error.
i try like:
array('date', 'constraint', 'readOnly'=>true, 'on'=>'update'),
but i am having this error:
"include(constraint.php): failed to open stream: No such file or directory"
I can disable from view using htmloptions but i need do it from model because on update i need to disable more than 5 fields.
how could i do this?
thx in advance
You are declaring a rule with a validator that doesn't exist, so it's normal that you have an error:
This line is doing the following: apply the validator
constraint
on thedate
field onupdate
scenario with paramreadOnly
set totrue
.The validator
constraint
doesn't exists has a built in functonnality in Yii so if you havn't created it then it doesn't exist!Documentation:
Edit: In your form you could do something like:
As you can see the readonly value will depend on the scenario.