[eluser]Unknown[/eluser]
I'm fairly new to CodeIgniter, but I've been loving it so far. I'm almost done with my project, but I've run in to a problem. I've searched the forums and found topics that were similar, but they were either pre-2.0 or weren't quite what I wanted.
Basically I have a number of Yes/No radio buttons. If the user selects "Yes", I'd like to display an "Explain" input field that they will be required to fill out. If they choose "No" it is not a required field. I've got the display part working, but I'm having trouble figuring out to make "Explain" required based on the radio button value. This needs to happen for multiple radio buttons/explain fields.
Just a little background in to my set up, this is a multi-page form (only two pages need this functionality) and I'm using sessions to store the data until submitting. I have my Validation rules set up in a config file like so:
Code:
<?php
//config/form_validation.php
//Validation rules for application
$config = array(
'step_1' => array(
array(
'field' => 'first_name',
'label' => 'First Name',
'rules' => 'required|trim|xss_clean'
),
array(
'field' => 'last_name',
'label' => 'Last Name',
'rules' => 'required|trim|xss_clean'
),
... etc.
Has anyone done anything similar before and gotten it to work? I was going to do a callback but I'm not 100% sure how I'd need to do it in this case.
Thank you in advance!