Create multiple subclasses of Form Validation + callback inside should work |
This is a two-part problem because I believe the issues are dependent on each other.
What I want to achieve: I am creating a site with multiple specific forms and I want each of them to have their (1) own validation class instead of a bloated MY_Form_validation.php. (2) Callbacks will also happen inside that validation class and not within the form's controller. OK CASE: I create MY_Form_validation.php with a callback method called "check_value": PHP Code: <?php check_value is called inside validate() and it is called without the "callback_" prefix. It works that way. This validation class is used in the form controller as: PHP Code: public function __construct() and the method called: PHP Code: $this->form_validation->validate(); NOK CASE: Same settings with OK CASE, just with a classname like "Car_registration_form_validation" and the manner of usage: PHP Code: public function __construct() PHP Code: $this->car_registration_form_validation->validate(); With the settings above, I get the following error: Code: Unable to access an error message corresponding to your field name my_field.(check_value) My questions:
|
Messages In This Thread |
Create multiple subclasses of Form Validation + callback inside should work - by 678238515702801 - 09-04-2016, 08:31 PM
RE: Create multiple subclasses of Form Validation + callback inside should work - by dave friend - 09-05-2016, 09:21 AM
RE: Create multiple subclasses of Form Validation + callback inside should work - by 678238515702801 - 09-05-2016, 05:20 PM
|