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
https://forums.phpfreaks.com/topic/241979-cakephp-validation/
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
https://forums.phpfreaks.com/topic/241979-cakephp-validation/#findComment-1249563
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.