문제

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.

도움이 되었습니까?

해결책

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');
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top