I need to set up some validation for a form field based on a value of another field.
For instance if profession is Doctor, then require specialty not to be blank ('') or none ('none').
$professionOptions = array(
'' => 'Choose Profession',
'Dr.' => 'Dr.',
'zzz' => 'zzz',
'None' => 'None');
$this->validator->field('profession')->inArray(array_keys($professionOptions)) ->message('Invalid profession.');
$specialtySelectOptions = array(
'' => 'Choose Specialty',
'Heart' => 'Heart',
'Lungs' => 'Lungs',
'Feet' => 'Feet',
'Nose' => 'Nose');
How do i make the following dependent on the profession?
$this->validator->field('specialty')->inArray(array_keys($specialtySelectOptions))
->message('Invalid salutation.');