Be careful Mark, I think that by this way you'll get the same issue
that I got...

=> 
http://groups.google.fr/group/symfony-users/browse_thread/thread/8473bed60eda6dbe

setDefault() didn't work for me within the form to "force" a value got
from session ; but it worked when I call this method from the action
class.

I'm still looking for a way to force this setting within the form..

--
Adrien Mogenet

On 22 avr, 12:34, Mark Smith <[email protected]> wrote:
> I have a form with a list of services on it. When the user submits the
> form, I want it to remember what item on the list was selected. Even
> if it's several page requests later.
>
> I'm storing the index in session and trying to apply it to the form
> field. Sending it in the constructor is probably tidier anyway, so I'm
> changing it to do that.
>
> But for future reference, you are saying $form->setDefault('field',
> 'value'); will work even after it's constructed and configure() has
> been called?
>
> On Apr 22, 10:38 am, Bernhard Schussek <[email protected]> wrote:
>
> > Hi Mark,
>
> > On Wed, Apr 22, 2009 at 10:23 AM, Mark Smith
>
> > <[email protected]> wrote:
> > > So you are saying the only way to change a form field once the object
> > > exists, is to completely rebuild the form?
>
> > No. The question is _when_ you want to change the form. You can change
> > the default values any time in the object lifecycle before you render
> > the form. Note that the default values are not displayed anymore once
> > you call ->bind().
>
> > If you need more help, please provide a little more information on
> > what you are trying to achieve. Otherwise it's hard to give you
> > specific advice.
>
> > Bernhard
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to