You can add and remove validation rules on the fly before you check if the form is valid.
On 22 May 2014 19:50, Advantage+ <movepixels@gmail.com> wrote:
--I am building a questionnaire where the user can add questions to a form (either yes or no or text answer response)
So the Question has id, quiz_id, question, type (text or true / false),
But how would you validate this?
In the view I simply do a foreach ($questions as $question){
echo $this->Form->input($question['question']['id'], array(
'label' => $question['Question']['question'],
'type' => $question['Question']['type'],
'div' => false));
But how do you validate this since model validation will not know these input / field names
The fieldname will be dynamic.
Thanks,
Dave
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
Kind Regards
Stephen Speakman
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment