2007/8/21, Francisco Gama Tabanez Ribeiro <[EMAIL PROTECTED]>:
>
> So, this is my problem..
> I need to generate forms dynamically with input names that may change
> in some circumstances. This means that i can't use pre-determined
> method arguments to retrieve the input from these forms.
> Even if i did these forms are often too big (with many input fields)
> and i can't keep mapping all of them with method arguments.
> So i (probably) need widgets... TableForm widgets (?)... I've tried
> some things (from the book)...
>
> I did something like:

skip ...

>     @expose()
>     @validate(form=name)     #this is probably wrong...

The 'form' argument of the @validate decorator may be callable. In order to use
dynamic form, you need to supply a callable object which returns generated
form object. For example like this:

def genform(form):
    # ...

      @validate(form=genform)

See tubgogears/controllers.py:validate() for details.

I have never used TG Widgets but I have succeeded with similar approach when
validating other kind of dynamically generated forms.

Cheers,

-- 
Timur Izhbulatov -- www.timka.org

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