Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Validating form_dropdown() with set_rules()
#1

[eluser]Unknown[/eluser]
This is what I have in my view:
Code:
echo form_dropdown('country', $country_list, set_value('country',$country));
// Here $country_list holds an array associative array, eg;
// ""=>"Select Country",
// "AF"=>"Afganistan", etc...

This is my controller where the validation is being done:
Code:
$this->form_validation->set_rules('country', 'Country', 'trim|required|max_length[80]');

The above validates fine. But if I manually change the key of "Select Country" in the HTML using Firebug, the above validation fails and it allows "Select Country" to be entered into the database.

How can I stop this from happening?




Theme © iAndrew 2016 - Forum software by © MyBB