On Fri, Jul 26, 2013 at 5:00 PM, Dennis Backhaus <
[email protected]> wrote:

> I am not sure if my english is too bad to explain my point here. I will
> try again with code:
>
>     unit = SingleSelectField(
>             label="Unit",
>             options=['seconds','minutes','hours','days','weeks'],
>             value='days'
>             )
>
> ^^ This is how I can pre-fill a SelectField currently.
>
>     arm_id = TextField(
>             label="Arm ID",
>             attrs=dict(disabled=True),
>             value=1444742
>         )
>
> ^^ This is how I can pre-fill a TextField.
>

That provides a default value. It's not actually what I meant for
prefilling :D


> What I do not know is how to get the parameter/that dictionary into my
> form. Do I do this in the class UserForm? Do I do this in the template? I
> do not know. This is why I am posting here.
>

You just pass them as the "value" argument to the form .display call.
Here again, look at the first documentation link I provided you:
http://turbogears.readthedocs.org/en/tg2.3.0b2/cookbook/TwForms.html#displaying-forms
The third block of code, where form.display is called.

-- 
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/groups/opt_out.


Reply via email to