Hi,

Someone posted a widget for this, called "dynwidget" a little while 
back. I couldn't actually find it searching the archives just now, but I 
have the file here; mail me privately if you'd like it.

You mention in a later post you're fairly happy with the JavaScript side 
of this. The validation is actually very easy. DynWidget is an extension 
of a RepeatingFieldSet, which uses a ForEach validator. That validator 
does not need to know in advance how many rows you have - you get 
extendability out of the box.

Saving the data back to the model is easy enough in this example of a 
single extendable form. I have a somewhat more complicated form that 
involves many growable fields, and two levels of nesting. I've coded an 
SQLAlchemy extension to help with saving this to the db. It's very hacky 
at the moment, but I am planning to eventually tidy it up and release it.

Paul


Chris Miles wrote:

>Hi!  I have a need for a form with a variable number of text fields.
>For example, the form may start with one text field, and if the user
>wants to add more values, they click on "+"  and another text field is
>dynamically created below the first (with javascript) and so on.
>
>Is there a widget floating around that already handles this use case
>nicely?  (I've scanned cogbin and PyPI already, but can't see anything
>that would do it).
>
>If not, any tips on the best way to implement this?  I know how to
>build basic widgets and forms, but haven't tried to handle a form
>where there would be an unknown number of submission fields.
>  
>


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