according to input-element
i used CForm::dropdownlist
<select name="MyForm[gender]" id="MyForm_gender">
because it always selected by default with "0" value (not empty).
how i can validate with rules?
thanks for your suggestion
is there a validation that except "0" as default value.
i mean if its value is not "0", it means not empty.
Why not user the prompt element command in your dropdown list call. That way there is no value attached to default
'prompt'=>'Please select gender:',
... rest of your stuff
<?php echo $form->dropDownList($model,'gender', array('0'=>'Male', '1'=>'Female'), array('prompt'=>'Please Select')); ?>
no problem. It’s nice to be on the giving end of help once in a while:D
You are indeed the man with a hammer today. Just like your avatar
Have been struggling for a while trying to find a solution for this.
I was trying all kind of regular expressions. but all this time I just needed