Alessandro:

I cannot even pre-fill the form with a set value directly from the 
template. I just changed my template code to this:

<form xmlns:py="http://genshi.edgewall.org/"; class="floatform" 
py:attrs="w.attrs">
    <div py:if="w.error_msg" class="formerror" py:content="w.error_msg"/>
    <div py:if="w.help_msg" class="formhelp">
        <p py:content="w.help_msg"/>
    </div>
    <div py:replace="w.child.display(value=dict(last='enter this'))"/>
    <div py:for="button in w.buttons" class="field" 
py:content="button.display()"/>
</form>

The last field is staying empty upon calling up the form. How can this be? 
(I know I spelled it right, also tried upper case L)

On Friday, July 26, 2013 11:32:58 AM UTC-4, Alessandro Molina wrote:
>
> On Fri, Jul 26, 2013 at 5:00 PM, Dennis Backhaus <
> [email protected] <javascript:>> 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