i have drop down named "business_id".
<select name="business_id"> <option value="0">select business</option> more options... </select> here comes validation rule, user must select option.
$this->form_validation->set_rules('business_id', 'business', 'greater_than[0]'); problem being error message says: business field must contain number greater 0. not intuitive! want "you must select business".
i tried:
$this->form_validation->set_message('business', 'you must select business'); but ci complete ignores this. have solution this?
try not setting value attribute on default select...
<select name="business_id"> <option value>select business</option> more options... </select> and using required form validation rule...
$this->form_validation->set_rules('business_id', 'business', 'required'); i suppose try editing way you're trying set message also...
$this->form_validation->set_message('business_id', 'you must select business'); instead of $this->form_validation->set_message('business', 'you must select business'); i'm not entirely sure if trick though.
Comments
Post a Comment