The continuing saga of 2 tables, 1 form. (Actually, it's multiple
tables, multiple forms, but the simplified case is as stated in the
title.)
# Model:
db.define_table('table1',
...
Field('t1f08','string',label=T('t1f08'),requires=IS_IN_SET
(['a','b','c'])
...
)
db.define_table('table2', ... same stuff ...)
# Controller:
form = SQLFORM.factory(
Field('text','text',default=message,
label=T('Message'),
requires=IS_NOT_EMPTY()),
db.table1,
db.table2,
)
if form.accepts(request.vars):
db.table1.insert(**dict(text_form.vars))
db.table2.insert(**dict(text_form.vars))
session.text=form.vars.text
# View:
{{=form.custom.begin}}
{{=TABLE(
TR(TH(form.custom.label['text']),
TD(form.custom.widget.text))
)}}
{{=TABLE(
TR(
TH(form.custom.label['t1f08']),
TD(form.custom.widget.t1f08),
TH(form.custom.label['t2f23]),
TD(form.custom.widget.t2f23),
),
)}}
...
{{=text_form.custom.end}}
So far, so good. Everything displays fine. But, when I submit, that's
when the trouble begins:
Traceback (most recent call last):
File "C:\web2py\gluon\restricted.py", line 178, in restricted
exec ccode in environment
File "C:/web2py/applications/myapp/controllers/input.py", line 53,
in <module>
File "C:\web2py\gluon\globals.py", line 101, in <lambda>
self._caller = lambda f: f()
File "C:/web2py/applications/myapp/controllers/input.py", line 38,
in input
if form.accepts(request.vars):
File "C:\web2py\gluon\sqlhtml.py", line 743, in accepts
onvalidation,
File "C:\web2py\gluon\html.py", line 1237, in accepts
status = self._traverse(status)
File "C:\web2py\gluon\html.py", line 447, in _traverse
newstatus = c._traverse(status) and newstatus
File "C:\web2py\gluon\html.py", line 447, in _traverse
newstatus = c._traverse(status) and newstatus
File "C:\web2py\gluon\html.py", line 447, in _traverse
newstatus = c._traverse(status) and newstatus
File "C:\web2py\gluon\html.py", line 447, in _traverse
newstatus = c._traverse(status) and newstatus
File "C:\web2py\gluon\html.py", line 454, in _traverse
newstatus = self._validate()
File "C:\web2py\gluon\html.py", line 1046, in _validate
(value, errors) = validator(value)TypeError: 'Set' object is not
iterable
Seems like the validator is getting all choked up, but that's deep in
gluon territory. Any developer help out there? I'm on web2py Version
1.65.11 (2009-08-04 16:42:46)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---