Hello,
I am developing a web site with codeigniter.
I have a form where I have a few group radio buttons.
When validation fails, one group radio keeps its value but the other doesn't.
I can't find why.
My code for the radio that does not work:
<label for="accommodationYes" class="accomm" id="accommY">
<input name="accommodation" type="radio" id="accommodationYes" style="display:none;" value="Yes"<?php set_radio('accommodation', 'Yes'); ?>>
<span class="custom radio"></span> Yes
</label>
<label for="accommodationNo" class="accomm" id="accomN">
<input name="accommodation" type="radio" id="accommodationNo" style="display:none;" value="No"<?php set_radio('accommodation', 'No'); ?>>
<span class="custom radio"></span> No
</label>
My code for the radio group that does work:
<label for="eft"><input name="payment" type="radio" id="eft" style="display:none;" value="EFT"<?php echo set_radio('payment', 'EFT'); ?>><span class="custom radio"></span> EFT</label>
<label for="cash"><input name="payment" type="radio" id="cash" style="display:none;" value="Cash"<?php echo set_radio('payment', 'Cash'); ?>><span class="custom radio"></span> Cash</label>
<label for="cheque"><input name="payment" type="radio" id="cheque" style="display:none;" value="Cheque"<?php echo set_radio('payment', 'Cheque'); ?>><span class="custom radio"></span> Cheque</label>
My validation code:
$this -> form_validation -> set_rules('accommodation', 'Accommodation', 'required|xss_clean' );
$this -> form_validation -> set_rules('payment', 'Payment', 'required|xss_clean' );
Can someone please help me find the problem?