Question

I have an input select field named risk_level_id for my advance_search action in Controller Abc.

echo $this->Form->input('risk_level_id',array('empty'=>'Choose One'));

there is another action in Controller Abc named add_issue, in that action there also a select field for selecting the risk_level_id from drop down that is required field in that form.

validation process is defined for risk_level_id in Model.

for advance_search action i didn't want the risk_level_id field is to be required. so what will i have to do to make it required field in one action and in other action it didn't seems to be required with in a same controller and Model.

Was it helpful?

Solution

just to add this line in your action

 $this->ModelName->validator()->remove('Action');

if u you want to remove only one rule on any field.

 $this->ModelName->validator()->remove('Action Name', 'Rule Name');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top