How to set validation rules for all fields. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: How to set validation rules for all fields. (/showthread.php?tid=88404) |
How to set validation rules for all fields. - sknair143 - 09-04-2023 Hello, I have more than 20+ fields where the values are required. so manually adding one by one to the property like : PHP Code: protected $validationRules = [ Is there any other alternative way to do this for all ? RE: How to set validation rules for all fields. - kenjis - 09-05-2023 There is no other way than to write code that manipulates array ($this->validationRules) in a usual way. But I recommend you write 'required' manually, because it is easy to understand the code. |