CodeIgniter Forums
Validating Nullable Fields - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29)
+--- Thread: Validating Nullable Fields (/showthread.php?tid=70460)



Validating Nullable Fields - donpwinston - 04-12-2018

Right now CI4 validation rules fail if the field is empty. So that they only work properly when the field is required. There should be a "nullable" rule to fix this problem. (I believe Laravel does this)

Otherwise null values should not fail validation by default.

See this post https://forum.codeigniter.com/thread-68554-post-352959.html#pid352959


RE: Validating Nullable Fields - natanfelles - 04-13-2018

We have the "permit_empty" rule. I think this is what you are looking for.

https://bcit-ci.github.io/CodeIgniter4/libraries/validation.html#available-rules


RE: Validating Nullable Fields - donpwinston - 04-13-2018

Yes! Missed it.