How do you want to show the error next to the hidden field? All hidden fields are on the beginning of the form, aren't they?
On 7 čvn, 16:35, Asier <aillarrame...@gmail.com> wrote: > Hi there, > > I have a form with an embedded form, wich can have N embedded forms: > > parentForm: > wrapperForm: > form_1 > form_2 > ... > form_n > > Nice. The problem is that this child forms have a date field (actually a > hidden field: sfWidgetFormInputHidden) which I must check so that: > form_1.date <= form_2.date <= ... <= form_n.date. So, I have opted to use a > callback postValidator in "parentForm". I set this in parentForm configure() > method: > > $this->validatorSchema->setPostValidator(new sfValidatorCallback(array( > 'callback' => array($this, 'validateSchema'), > ))); > > And this is my "validateSchema" method: > > public function validateSchema(sfValidatorBase $validator, array $values) > { > $previous_date = 0; > $forms = $this->embeddedForms['wrapperForm']->getEmbeddedForms(); > > foreach ($values['wrapperForm'] as $form_id => $form) { > if (strtotime($form['date']) < $previous_date) { > *// ADD ERROR MESSAGE* > } else { > $previous_date = strtotime($form['date']); > } > } > > return $values; > > } > > Knowing that to access one of the child forms object, we can use > $forms[$form_id] within the for loop. How the hell can I add an error > message to the date field?? :( I don't want a global error, I just want the > error next to it's corresponding field. Any idea would be greatly > appreciated. > > Thank you, > Asier. -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en