Welcome Guest, Not a member yet? Register   Sign In
Validation, either or
#2

[eluser]Colin Williams[/eluser]
You just need a humble little IF control statement:

Code:
$rules['phone1'] = 'required';
if ( ! $this->input->post('phone1'))
{
   unset($rules['phone1']
   $rules['phone2'] = 'required';
}

Note that the condition to match might be more complex than that. You could otherwise have a check_phone_no() callback that essentially does the same thing... might be a little cleaner that way.


Messages In This Thread
Validation, either or - by El Forum - 08-17-2008, 10:39 PM
Validation, either or - by El Forum - 08-17-2008, 10:59 PM
Validation, either or - by El Forum - 08-17-2008, 11:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB