CodeIgniter Forums
Null Values in Validations - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: Null Values in Validations (/showthread.php?tid=78219)



Null Values in Validations - Misael Picco - 12-16-2020

Hi! I have noticed that some rules like in_list, numeric, integer, doesn't accept NULL or empty values because it throws an error (I think CI3 accepts them). That makes the value to be required always, I think it shouldn't be like that because for that purpose already exist the required rule, is it supposed to work this way? what can I do to change that behavior?
Thanks!


RE: Null Values in Validations - includebeer - 12-18-2020

Try the rule ‘permit_empty’.
http://codeigniter.com/user_guide/libraries/validation.html#available-rules


RE: Null Values in Validations - Misael Picco - 12-18-2020

(12-18-2020, 04:56 AM)includebeer Wrote: Try the rule ‘permit_empty’.
http://codeigniter.com/user_guide/libraries/validation.html#available-rules

Oh! thank you, I didn't see that rule, maybe I'm blind.  Big Grin