I'm new to Turbogears 2.3.3 and Toscawidgets 2. Could anyone tell me how to 
set the default value based on the id?

*URL*: .../view?id=2

*FormWidget*:

FruitForm(twf.Form):  
    class child(twf.TableLayout):  
        fruit=twf.SingleSelectField(options=DBsession.query(Fruit.id, 
Fruit.name)  

*Model*: Fruit
id, name

*Controller*:

@expose ('view')  def view(self, id)  
    fruit=DBSession.query(Fruit).get(id)  
    return dict(page='view', value=fruit, form=FruitForm(action='/save')  

*Template*:

<div>${form.display(value=value)}</div>  

*Question*:
When the url is /view?id=2, in the SingleSelectField how to display the 
fruit whose id is 2?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

Reply via email to