Yep, they probably are being bubbled up to the parentForm. Thank you for your help, I'll give it a try.
Bye! On Thu, Jun 10, 2010 at 10:03 AM, Tom Ptacnik <to...@tomor.cz> wrote: > I think that errors of hidden fields are rendered as global errors. > And from your description it looks like embeded forms leave their > global errors to the master form (I didn't look into Symfony how this > is done). > > So the solution would be just to create your own attributte in the > main form, set it in your validator. Then edit your template which is > showing the embeded forms -> test this attribute and show your error. > > your validator can look like: > foreach (all forms) > { > if date isn't good > set $this->subFormErr = 2; // mean subform 2 is bad > } > > ten in the template > if $form->getSubFormErr() == nowRenderedEmbededFormId -> echo "bad > date" > > > It can look like hacking the forms framework, but maybe your need is > such special, that it can't be solved by classic Symfony features. > > > On 8 čvn, 17:31, Asier <aillarrame...@gmail.com> wrote: > > 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> > <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<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