Welcome Guest, Not a member yet? Register   Sign In
radio button validation
#1

[eluser]ommy[/eluser]
I'm stabbing in the dark here.
How am i supposed to set up a working validation for a few radiobuttons.

Let's say i have this in my view:
Code:
<input type="radio" name="voor" value"1"> Part one
<input type="radio" name="voor" value"2"> Part two

then i would have this in my controller:
Code:
$this->load->library('form_validation');
$this->form_validation->set_rules('voor','radio','required');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('formwithradios')
}else{
echo 'hoorai';
}

The main problem i'm experiencing is that the value of the post variable is "ON" when something is selected. and false when nothing has been. I can imagine set_radio having trouble finding which radio button it should select after submitting/failing validation.


Messages In This Thread
radio button validation - by El Forum - 05-21-2010, 03:03 AM
radio button validation - by El Forum - 05-21-2010, 03:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB