Hahaha, yes, your solution works, but you really should dive into the API (and even peek on the sf source code itself) since there are many little useful methods and bits of code that are not present in any tutorials, but that will ultimately save the day. Anyways, glad you got your stuff working.
See ya! Campezzi On May 6, 12:30 pm, Stephen <[email protected]> wrote: > I think I need read through the sfForm API > lol > > On May 7, 1:14 am, Campezzi <[email protected]> wrote: > > > Hi Stephen, > > > In your action code, when you're creating the form so that it's > > available on the view, you can do so with two parameters. The first > > one is an object used to populate the fields with default data; the > > second one is an array of variables you're passing from the action to > > the form object itself. So... > > > $this->form = new FormClassName(array(), array('user_id' => $this- > > > >getUser()->getId()); > > > ... would give you a form with no populated fields (the first > > parameter is an empty array), with a variable called user_id passed to > > the FormClassName object. You can then access the user_id variable on > > the form class by using the getOption method of the sfForm class: > > > $this->getOption('user_id') > > > Mix this with a custom method for getting the form field choices and I > > guess you have a solution there! > > > Hope to have helped. Good luck! :) > > > Thiago Campezzi > > > On May 6, 11:45 am, Stephen <[email protected]> wrote: > > > > Thanks, but how can I pass a value to the method? > > > > On Apr 20, 7:13 am, Joan Teixidó <[email protected]> wrote: > > > > > hi, > > > > > you can create an instance of sfWidgetFormPropelChoice with the opcion > > > > peer_method: > > > > > form['addres] = new sfWidgetFormPropelChoice(array('model' => > > > > 'myModel'',peer_method' => 'myMethod')) > > > > > Joan > > > > 2009/4/19 Stephen <[email protected]> > > > > > > A form generated by symfony, there is a field "address". I don't want > > > > > it lists all the addresses in the dropdown list, but only the ones > > > > > associated with the user who is browsing this page, user has a user > > > > > ID. Could any one tell me how to implement this? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
