[eluser]123XD[/eluser]
Hi all,
I just had a question about drop down list validation.
I have some code like this in the view file
Code:
<select name="model">
<option value=""></option> <!-- First value here is empty, used for validation -->
<option value="AAA">AAA</option>
<option value="BBB">BBB</option>
<option value="CCC">CCC</option>
</select>
and in related controller, I got
Code:
$rules['model'] = "required";
$this->validation->set_rules($rules);
$this->validation->set_message('rule', 'Error Message');
While I test this on localhost, it does not give me the error message.
I wanna drop down list to be mandatory. which means if the first option value is selected(in this case is blank), it gives user a error message.
I have read the user guide about validation class, but still cannot figure it out.
Does anyone has any ideas about this?
Thanks