Hey man,

I know what you mean, for example - I have a checkout form that uses
authorize.net to validate a credit card, but I don't want to trigger
the validation until the basic for validation passes.
The way I go about it is override the doBind method to first call the
parent::doBind method, and then - if we get here, basic validation
passed - I do my custom validation, and if that fails, I manually
throw a validation error that is caught by the parents bind method and
handled like just any regular error. You can even attach the error to
a specific field if you want, or keep it global.

The advantage of this approach is that you keep validation of all sort
inside the form, so the action doesn't have to be concerned with any
of that.
Does that help?

Daniel




On Apr 12, 4:05 am, WallTearer <walltea...@gmail.com> wrote:
> Hello guys.
>
> I have symfony 1.4 with Doctrine.
>
> Basically, in my form I need to make some specific validation upon
> several fields. And in some cases (when these specific form errors
> happen) module's action should perform necessary tasks.
> So I'm wondering how can I know that specific error happened? Because
> $form->isValid() method return only bool value.
> I think that I will probably need to write custom PostValidator, but
> should it raise a global error?
>
> Thanks in advance.

-- 
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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to