Welcome Guest, Not a member yet? Register   Sign In
Validation driving me nuts
#1

[eluser]nl_vinyl[/eluser]
Hi,

I am trying to validate 2 radio buttons. They share the same name and have no default checked:

Code:
<label class="radio">
&lt;input type="radio" name="verrekening" value="intijd" /&gt;
Label 1
</label>

<label class="radio">
&lt;input type="radio" name="verrekening" value="uitbetalen" /&gt;
Label 2
</label>

And I am displaying the errors in my form like this:

Code:
&lt;?php if(validation_errors()): ?&gt;
     <div class="alert alert-error">
     &lt;?php echo validation_errors(); ?&gt;      
     </div>
&lt;?php endif; ?&gt;

My controller has the rules set up like this:

Code:
$this->form_validation->set_rules('verrekening', 'Verrekening', 'required');
$this->form_validation->set_error_delimiters('<div class="error">', '</div>');
$this->form_validation->set_message('required', '<strong>%s</strong> niet opgegeven.');

If i do not select a checkbox, I am returned to the form but not error is shown. If I select an option the form is processed. I cant find what I am doing wrong.

If I chance the radiobuttons in a simple text field and leave that empty the error is shown. Does the validation helper have an issue with radio buttons?
#2

[eluser]nl_vinyl[/eluser]
Solved:

http://ellislab.com/forums/viewthread/233056/

Nasty solution, but works.




Theme © iAndrew 2016 - Forum software by © MyBB