I'm a bit stuck with dynamic form generation with formalchemy and then
handling the results with web.py.
Formalchemy's .render method generates dynamic field names for its
rendered HTML forms. When these get posted back to the server, the
resulting web.py Storage dict looks like this:
<Storage {'Member-2371-country': u'', 'Member-2371-postal_code': u'',
'Member-2371-preferred_cuisines': u'19', ... >
In my app, "preferred_cuisines" is a checkbox on the form, thus
generating multiple values in the resulting POST. Web.py's
utils.storify method, as clearly documented, will only convert them to
a list when the field name is included in the defaults when it is
called, eg:
>>> storify({'a':[1, 2]}).a
2
>>> storify({'a':[1, 2]}, a=[]).a
[1, 2]
So all I need to do, when getting the data via web.input(), is just to
pass in the field names I want to be lists. But since with
formalchemy, the field names are dynamically generated and have dashes
in the name, I would need to do something like this:
i = web.input(Member-2371-preferred_cuisines=[])
...which clearly won't work.
Is there a way around this?
John
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---