I am not sure I fully understand but I am not surprised it does not
work. Would do this instead

from gluon.sqlhtml import form_factory
form=form_factory(db.my_table, SQLField('tcha',requires=[IS_IN_SET(tch
[1])]))
if form.accepts(...):...
      db.my_table.insert(**dict([q for q in forms.vars.items if q[0]
in db.my_table.fields]))


On 20 Apr, 15:22, Jose <[email protected]> wrote:
> On 20 abr, 15:39, mdipierro <[email protected]> wrote:
>
> > please post a complete controller that exhibits the problem.
>
> > Massimo
>
> import applications.myapplication.modules.textchas as textchas
> ...
> def my_controller():
>     form=SQLFORM(db.my_table)
>     if session.tch == None:
>         session.tch = textchas.get_tch()
>
>     tch = session.tch
>     form[0].insert(len(form[0])-1, TR('Validate:', tch[0], ''))
>     form[0].insert(len(form[0])-1, TR('', INPUT(_name='tcha', requires=
> [IS_IN_SET(tch[1])]), ''))
>     if form.accepts(request.vars,session):
>         session.tch = None
>         response.flash='form accepted'
>
>     return dict(form=form)
>
> This works well, does what I hope that it does, only that sends the
> possible answers to the client.
> As I said before, if from the browser I see the source code of the
> page, there the answers are.
>
> Get_tch () returns a tupla where the first element in a string
> (question), and the second a list of strings (the answers).
>
> Jose
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to