Thursday, 15 September 2011

drop down menu - Yii combobox validation -



drop down menu - Yii combobox validation -

i developing yii framework

this part of view

echo chtml::dropdownlist('codcity', '',$citylist);

the dropdown filled in end, alternative that

<option value="xx">(select city)</option> <option value="rm">rome</option> <option value="fl">florence</option> ...

from validation viewpoint, first alternative (xx) not valid, while others valid in model have

public function rules() { homecoming array( ... array('codcity', 'compare', 'operator'=>'!=', 'comparevalue'=>'xx' , 'message'=>'please select city'), ... ); }

and validation rule apply codcity field.

unluckily, things not going suppose, , options validated 'good', bad 1 (xx)

any suggestions?

thank much

have @ http://www.yiiframework.com/doc/api/1.1/chtml#dropdownlist-detail

you can specfiy prompt option.

prompt: string, specifies prompt text shown first list option. value empty. note, prompt text not html-encoded.

drop-down-menu yii validation

No comments:

Post a Comment