Welcome Guest, Not a member yet? Register   Sign In
Extending Form Validation
#3

[eluser]ci_user[/eluser]
Thank you for your response. I am not testing with a blank value. I want to validate that IF there is a value (though not required) that it is a valid format - but the valid_date function will only run if the field is required. It's frustrating that it works fine if I include the function as a callback in the controller:

Code:
$this->form_validation->set_rules('dob', 'D.O.B.', 'callback_valid_date');

That seems inefficient. Also, I have changed the lowercase "V" in the file and class name, although all the other required custom validations work fine with the uppercase.


[quote author="Aken" date="1359151832"]First, your file and class name should not have a capitalized V. It should be MY_Form_validation.

Second, there is logic in the class that says "If the field is blank, but NOT required, no further tests are necessary." So if you are testing it with a blank value, your rule won't fire. If you add a value, it should work. This is standard functionality of the library.[/quote]


Messages In This Thread
Extending Form Validation - by El Forum - 01-25-2013, 08:43 AM
Extending Form Validation - by El Forum - 01-25-2013, 03:10 PM
Extending Form Validation - by El Forum - 01-28-2013, 06:59 AM
Extending Form Validation - by El Forum - 01-28-2013, 08:19 AM
Extending Form Validation - by El Forum - 01-28-2013, 08:23 AM
Extending Form Validation - by El Forum - 01-28-2013, 08:33 AM
Extending Form Validation - by El Forum - 01-28-2013, 09:41 AM
Extending Form Validation - by El Forum - 01-28-2013, 06:14 PM
Extending Form Validation - by El Forum - 01-29-2013, 06:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB