Calling $form-setDefaults(null) resets all values in the form, that
should work in principle (didn't try out yet). It's a sort of full
reset, and the fields should get the defaults as
If you desire the tainted values (the ones the user entered before
validating them, you could use something like $form->setDefaults($form-
>getTaintedValues()).

However there's a further issue, as the form maintains a reference to
an object (which you probably have saved after bind()), and in
principle this same object will remain bound to the form as long as
this form does exist. Unfortunately there's no such thing like e.g.
$form->setObject(new Contact()); (=> I guess this is your intent, to
provide the user with the form for a new object. Otherwise pls
explain.)
You can get around the problem by subclassing the Form, in order to
gain direct access to the $object variable within the form. The main
parts in the SF code are namely sfFormDoctrine.class.php and
sfFormObject.class.php.

As ken stated above, also me I ended up in redirecting, that's for
sure the clean way. And shouldn't be a major performance issue (I
hope...).

Cheers, RAPHAEL


On 18 Jan., 13:23, ken <marfillas...@gmail.com> wrote:
> It doesn't have. And it is highly advisable that a redirect is
> executed after a form is processed. The only time no redirection will
> happen is if the form is invalid.
>
> On Jan 18, 7:02 pm, DoRiaN <doria...@gmail.com> wrote:
>
>
>
> > Ok there are lot of solutions, buf does sfForm have a method to this ?
>
> > On 15 jan, 14:39, Tom Ptacnik <to...@tomor.cz> wrote:
>
> > > If you want to clear the form after it's proccessed, you can simply do
> > > redirect to the same form (in the action)
>
> > > On 15 led, 12:23,DoRiaN<doria...@gmail.com> wrote:
>
> > > > Hello,
>
> > > > How to delete values after bind() ?
> > > > I want to clean my form.
>
> > > > Thank,
-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@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.


Reply via email to