sanfly Posted July 9, 2011 Share Posted July 9, 2011 Hi I have three fields in a form: Mobile Phone, Home Phone and Work Phone. I require just one of these three fields to be filled in - is there a way to define this with the model data validation? I can make all three required, but like I said I require only one Cheers Quote Link to comment https://forums.phpfreaks.com/topic/241494-cakephp-form-validation/ Share on other sites More sharing options...
244863 Posted July 14, 2011 Share Posted July 14, 2011 Hi, Just use the beforeValidate() function to set the value of the null fields to 'default' or 'N/A' then use the validate() function in the model to do a notEmpty(). Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/241494-cakephp-form-validation/#findComment-1242683 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.