Wow, thanks! Python is pretty amazing. (I come from a largely C background.)
On Monday, 31 March 2014 01:06:11 UTC-4, Anthony wrote:
Yes, that will do it. form.vars (as well as request.vars and many other
web2py objects) is a gluon.storage.Storage object, which is much like a
dictionary
Treating a form like a Python list works like a charm. However, having
dynamically added SELECT fields, I don't know how to extract the form.vars
for these fields. I don't know how to assign _name in a way that I can
reference it after the form has been accepted. For example,
elements
Well, you need some way to dynamically create names for your fields as
well. Figure something out based on whatever you are using to construct the
fields themselves.
On Sunday, March 30, 2014 7:45:56 PM UTC-4, horridohobbyist wrote:
Treating a form like a Python list works like a charm.
But if I create a name such as, for example, color, I'd need to access
the form variable thusly: form.vars.color. Since the name was created on
the fly, how can I actually say form.vars.color?? If the name was created
and stored in a variable, say, x, I can't say form.vars.x. I guess I
don't
Try form.vars['color'] or take a variable v
v=color
form.vars[v]
2014-03-31 2:32 GMT+02:00 horridohobbyist horrido.hobb...@gmail.com:
But if I create a name such as, for example, color, I'd need to access
the form variable thusly: form.vars.color. Since the name was created on
the fly,
Yes, that will do it. form.vars (as well as request.vars and many other
web2py objects) is a gluon.storage.Storage object, which is much like a
dictionary and allows dictionary-like syntax for accessing items. Similar
syntax works with DAL Table and Row objects.
Anthony
On Monday, March 31,
FORMs are just HTML helpers, so you manipulate them after creating them.
You can therefore just treat them like python lists, but there is
functionality which may be more helpful:
http://web2py.com/books/default/chapter/29/05/the-views#Server-side-DOM-and-parsing
On Sunday, 30 March 2014
7 matches
Mail list logo