![]() |
How can I pass the field label to the validation class so I can return the error with the field label?
Previously, we could do a callback function with {field} and it would convert that into the field label to be returned with the error. (ignore the goofy attempt at the validation rule checking for string length, I know that is already built in. This is strictly as an example) MyController.php PHP Code: $this->validation->setRules([ MyValidationRules.php PHP Code: class MyValidationRules How can I get the error to return: "The First Name field needs to be last least 1 character long." Thank you for your attention.
CodeIgniter 4 Validation Library - eithRequest()
SEE: how it's handaling error messages. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(11-19-2021, 03:25 AM)InsiteFX Wrote: CodeIgniter 4 Validation Library - eithRequest() I've scoured that page and I did not seeing anything on how to get the label to the Validation class. But your direction gave me an idea which wasn't spelled out in the documents (some of us need real world examples beaten over our heads). So here's the solution for anyone wanting it. MyController.php PHP Code: $this->validation->setRules([ MyValidationRules.php PHP Code: class MyValidationRules Thanks for the help! |
Welcome Guest, Not a member yet? Register Sign In |