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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.