• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
{SOLVED]Conditional Validation

[eluser]eric cumbee[/eluser]
i have a form that is broken up into several sections. some sections only need to be filled out in certain circumstances, mainly if the user checked a check box. im using jquery to hide and show those sections based on the user input. that is working fine.

the question i have now, is how do i setup form validation (using the CI form validation) so that if a certain check box is not checked, it will not worry about validating the fields in that form section.

What about checking states of checkboxes first and then building validation rules for desired fields based on that?

I think you will have to do something like:
    $this->form_validation->set_rules('field','Field','your rules');

Currently there is no Conditional form validation in CI. That or write a new custom rule to handle the case and possibly patch the Form_validation class.

[eluser]eric cumbee[/eluser]
that worked i did not think it would be that simple

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.