I'm setting up the required rule based on condition but looks like it abuse the condition. what I am I went wrong ???
['objective_id','required','when'=>function($model){ return $model->subcategory_id == 3; }],
I'm setting up the required rule based on condition but looks like it abuse the condition. what I am I went wrong ???
['objective_id','required','when'=>function($model){ return $model->subcategory_id == 3; }],
I figure out my problem, the code is right but I forgot that I'm working with ActiveRecord. I solved it by set up the field "objective_id" to null in a database table