Unable to use validation rules that I set to the Config file |
Hi, I am trying to perform form validation for user registration page with CodeIgniter 4. To do this I have written below codes in Validation.php file located in Config directory.
Config/Validation.php PHP Code: public $userSignUp = [ Then I get this "userSignup" rule in my Users controller. Controllers/Users.php PHP Code: <?php namespace App\Controllers; Finally, to display those errors in the registration page. Views/user_register.php PHP Code: <?php if(isset($validation)): ?> But, when I submit the form, I get this error "userSignup is not a validation rules group". What is going wrong with my code?
Did you place your config rules in the class?
PHP Code: class Validation Also you using getRuleGroup where I believe it shoulld be setRuleGroup. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Glad you got it working.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |