Ehhh, ok, how can I be so stupid... ejem. ^_^U Anyway, how would it be if the field is a text input field??
Now that I notice, even if those fields are hidden, if I set an error on one of then, shouldn't they be rendered by the embedded form template if I put: $form->renderError() ?? I mean, all the hidden fields errors should be rendered by that renderError() so that they would apper in the embedded form context and no as parentForm's, isn't it? When I said "I just want the error next to it's corresponding field". I wanted to say that the errors should appear in the embedded form context, and not as global errors of parentForm. Sorry for the confusion, Asier. On Tue, Jun 8, 2010 at 3:55 PM, Tom Ptacnik <to...@tomor.cz> wrote: > 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<symfony-users%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en > -- 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