I have two numeric fields to collect data from users. Need to validate it using codeigniter form validation class.
Conditions:
- First field can be zero
- Second field cannot be zero
- First field should not be equal to second field
- Second field should be greater than first field
Currently I use
$this->form_validation->set_rules('first_field', 'First Field',
'trim|required|is_natural');$this->form_validation->set_rules('second_field', 'Second Field',
'trim|required|is_natural_no_zero');
But, how to validate for 3rd and 4th condition mentioned above?
Thanks in advance.
Best Answer
Thanks dm03514. I got it working by the below callback function.
and the callback function is:
Everything seems to be working fine now :)