April 1, 2012, 11:19pm
I’ve added two custom searches to use in my grid view but I have a problem when there is empty data for a particular row. This happens when a subject has no parent because it is itself a parent. Instead of an empty space which is what I have at the moment I’d like to specify a default value such as ‘No Parent’ or similar.
My criteria looks like this…
$criteria->with = array('subjectName','parentName' );
Does anybody know how I can accomplish this?
April 2, 2012, 4:41am
Thanks for the response Vince.
I found the ‘default’ attribute and read up on it.
I thought I’d set it up correctly but it’s still returning blank when the subject is also a parent.
Here’s my rule…
Can you see any problem with my settings?
April 2, 2012, 6:54pm
I’m still trying to solve this but am not having much success. Would appreciate any input from more experienced yii programmers.
(Maurizio Domba Cerin)
April 3, 2012, 9:28am
the validation rules are processed only after the validation… so you cannot set a value before validation with them
You just need to assign the value you need before the render.
$model->parent_search = 'No Parent';