Hi,

I am developing a form that uses nested widgets. The main form is Order 
and there is a variable number of Contact forms embedded (Contact has a 
foreign key to Order).

Nested widgets work great, using TableForm and RepeatingFieldSet.
Parsing the form parameters back to dictionaries and lists works great.
When saving the data to the database, I'm using SqlSchema from 
FormEncode. This works ok for doing individual rows, but I have to 
manually iterate to do the nested structure, something like:
order_schema.to_python(**kw)
for c in kw['contacts']:
  contact_schema.to_python(c)

I wondered, is it possible to do all this in one go? I am going to be 
attempting a much more complicated nested form soon and the ability to 
do this would be very helpful. Especially as I need to add an check to 
avoid parameter tampering attacks, basically 
Contact.get(c['id']).orderID == kw['id']
If this is not currently possible, I will have a go at writing a patch 
to add support.

While I'm here, a couple of other questions:
1) Can you build a widget form automatically from an SQLObject? I've 
seen mention of FastData, but I couldn't find any docs or examples.
2) Is it possible to combine a widgetform and a dataobject, into a 
single object? I'd like to generate my nested form from a template, just 
using widgets for the controls, not the form layouts. The template code 
for this is getting way out of hand with form.display_field_for('xx' .. 
It would be great to just have the columns replaced by controls, so I 
could do $order.name to get the appropriate text box.

Any help at all will be much appreciated. Thanks for reading,

Paul

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