On 2007-03-16 18:25, Alberto Valverde wrote:
> > - main template, page.kid snippet:
> > <div py:for="t in text">
> > <p py:content="t_form(dict(t_input=t.headline),
> > id=t.number, submit_text=t.headline)"/>
> > </div>
> >
> > (...)
> > But how can I pass foo to the widget at render time, when it sits
> > inside a form?
>
> Take a look at the first tip at http://docs.turbogears.org/1.0/
> RoughDocs/WidgetTips.
Thank you for this hint! I should have found this myself...
It looks clear, but didn't work.
I modified the page.kid-snippet above following the example in the tip:
<div py:for="t in text">
${t_form.display(dict(t_input=t.headline,
attrs=dict(t_button=dict(onclick='modifyTextblock(3,1);
return false'))), id=t.number, submit_text=t.headline)}
</div>
where t_form = TextblockForm()
Widgets are now defined separatly and listed in the fields-list of the
form (or are they accessed by "name"-attribut?):
class TextblockForm(widgets.TableForm):
template = 'myproject.widgets.templates.textblock'
fields = [t_input, t_button, t_cancel]
However, no attrs (onclick...) appear in rendered html-code. I tried
this with Button, TextField, other attributs, but nothing happens.
What am I missing?
Ciao,
Stefan
--
Start here: www.meretz.de
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---