Jump to content

CakePHP Validation


244863

Recommended Posts

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,

Link to comment
Share on other sites

  • 3 weeks later...

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.