244863 Posted July 14, 2011 Share Posted July 14, 2011 Hi, I have a form which has a foreach loop that loops through a database full of questions based on the questionniare they have selected to answer and builds the form/questionnaire like so: field1 field2 field3 but the next form might have 6 questions. How can I run a validation routine within the model that loops through any number of fields and does a notEmpty on each one. I know I can use <?php var $validate array() ?> but this makes you name all of the field names??? Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/241979-cakephp-validation/ Share on other sites More sharing options...
noibilism Posted July 15, 2011 Share Posted July 15, 2011 Post your code for us to see............... Model,View & Controller Quote Link to comment https://forums.phpfreaks.com/topic/241979-cakephp-validation/#findComment-1243031 Share on other sites More sharing options...
jcombs_31 Posted July 30, 2011 Share Posted July 30, 2011 I don' t quite follow, the form should have fields matching the fields in the database, so your model should be easy to set up validation based on the fields. Perhaps the DB is not designed correctly. Can you give a better example of exactly what you are trying to do? It sounds like you may need a many to many, but we'd need more details. Quote Link to comment https://forums.phpfreaks.com/topic/241979-cakephp-validation/#findComment-1249563 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.