Welcome Guest, Not a member yet? Register   Sign In
Validation rules from both config and controller
#2

[eluser]sketchynix[/eluser]
I'm not sure I understand your reason for doing this. Perhaps I misread it but from what I gather.. "if certain fields have data then I want to validate it, but they’re not required fields".. Why can't you just exclude the 'required' rule in your array for that field?

ie if username were required and age wasn't...
Code:
array(
             'field'   => 'username',
             'label'   => 'Username',
             'rules'   => 'required'
             ),
      array(
            'field'   => 'age',
            'label'   => 'Age',
            'rules'   => 'numeric'
           ),
If that were in the config and the user didnt input their age, the form would still pass validation.


Messages In This Thread
Validation rules from both config and controller - by El Forum - 10-09-2010, 03:53 AM
Validation rules from both config and controller - by El Forum - 10-12-2010, 01:45 PM
Validation rules from both config and controller - by El Forum - 11-27-2010, 05:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB