On Dec 14, 2006, at 5:40 PM, Petry wrote:

>
> Hi all,
>
> I've put te widget RemoteForm (Ajax Grid) um my Project, based on a
> example on the TurboGears trac [1]:
> <code>
> class GeraCampos(WidgetsList):
>     campo1 = TextField()
>     campo2 = PasswordField()
>
> class ContasContabeis:
>     @expose 
> (template="tgorcamentos.templates.contascontabeis_cadastro")
>     def cadastro(self):
>         name = "AJAX Form"
>         xxx = GeraCampos()
>         item_searchform = RemoteForm(
>             name="FormCtaContabil",
>             fields=GeraCampos(),
>             submit_text="Enviar")
>         return dict(item_searchform=item_searchform)
>
>     @turbogears.expose(format = "json")
>     def do_search(self, **kw):
>         time.sleep(5)
>         """ Echo the parameters back, json formatted. """
>         return """Received data:<br />%r""" % kw
> <code/>
>
> It works great, but I can't put the "GeraCampos" class outsite of the
> method "cadastro", and It's not correct put this class inside of the
> method (I guess!). There is another way to do this widget work?

Yep. List the fields inside the form initialization:

Form = RemoteForm(fields=[TextField("campo1"),PasswordField 
("campo2")], ...)

Don't forget to assign those fields a "name" (first positional)  
argument if declared in this way.

Alberto


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

Reply via email to