What about

    <div py:replace="w.child.display(kw)"/>

in your template code?

Although I'm suspicious about the need to access the child property of the 
widget!

Additional info that would help us to help:

   - TW1 or TW2?
   - Why do you explicitly request a widget instance in self.widget?
   Normally you shouldn't need to do that (in both versions of TW, IIRC).


Am Freitag, 26. Juli 2013 17:00:20 UTC+2 schrieb Dennis Backhaus:
>
> 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.
>
> What I do NOT know is how and where to pass the keyword arguments from my 
> Controller:
>
>     class UserController(AdminBaseController):
>     @expose('myproject.templates.widget')
>     def index(self, *args, **kw):
>         log.debug('***keywords for /admin/user link: ***%s***' %kw)
>         #w = UserForm(redirect='/user/').req()
>         #return dict(widget=UserForm(redirect='/user/').req(),page='user')
>         return self.widget(UserForm,kw)
>
> written into a dictionary or anything else in order to display it in the 
> form.
>
> FYI: 'kw' in the last piece of code holds a dictionary with all the URL 
> parameters that I need (verified with the log.debug message).
>
> 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.
>
> I am not sure how to make myself more clear, sorry. I read all the 
> theoretical information I could possibly find. I need someone to tell me on 
> what line in my code I am doing something wrong / missing something.
> On Friday, July 26, 2013 10:24:48 AM UTC-4, Alessandro Molina wrote:
>>
>> On Fri, Jul 26, 2013 at 3:59 PM, Dennis Backhaus <
>> [email protected]> wrote:
>>
>>> Yes Alessandro, I do understand the theory of this.
>>>
>>> 1) I do not want to create a dictionary of values and fill the form with 
>>> that. I want to take the value from the URL and put it into the form as 
>>> explained in all my posts above. I pasted my code here. Is anyone able to 
>>> tell me, based on my code, where I need to add which line(s) of code to 
>>> make this work?
>>>
>>
>> You told me multiple times that you are able to prefill the form... So 
>> you should already know how to take values from the url and pass them to 
>> the form.
>> Jus take the values, put them into a dictionary and pass the dictionary 
>> to the form .display call?
>>
>> I can only suggest you to try again with a basic page+form, because it is 
>> fairly straightforward to prefill forms with values from the url.
>>  
>>
>>> 2) I am really not sure where to put this into my code to make it work. 
>>> Sorry :(
>>>
>>
>>
>> http://turbogears.readthedocs.org/en/latest/turbogears/validation.html#validating-arguments
>>  
>

-- 
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