Yii: How to validate a form field? It can be null, but can not empty.
For example, I have a Book Model. When I do a form submitting, some of the fields can be null(not set), But It should not empty.
How to check it?
Yes you can, just not use that field in "required" validator, and use for this field any other, like "numeric" or some another validator. It will do a trick for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With