Hi Massimo
Here is the controller:
options = range(5)
def multi_input():
form = FORM(
TABLE(*[TR('T',INPUT(_type="checkbox",_name='T'))]+\
[TR("Option "+str(opt), INPUT
(_type="checkbox",_name=opt,value=False,_value='on'))
for opt in options]+\
[TR("",INPUT(_type="submit",_value="SUBMIT"))]))
opt_list = []
if form.accepts(request.vars,session):
session['form_vars'] = form.vars
redirect(URL(r=request,f='multi_out'))
return dict(form=form)
def multi_out(): return dict(result=session['form_vars'])
Thanks
ML
On Dec 7, 12:36 pm, mdipierro <[EMAIL PROTECTED]> wrote:
> I run this controller and everything seems to work to me. I do not
> understand the problem. Can you show the entire controller?
>
> Massimo
>
> On Dec 6, 8:58 pm, Maurice Ling <[EMAIL PROTECTED]> wrote:
>
> > Hi Massimo
>
> > It still gives me the same result:
>
> > For example, if I check "T", "Option 1" and "Option 2", I get
> > 1:
> > 2:
> > 3:
> > 4:
> > T:on
>
> > Is it possible that the list comprehension results in a (lambda)
> > function by itself; hence, unable to pass the message onto the calling
> > function?
>
> > Cheers
> > Maurice
>
> > On Dec 5, 3:31 pm, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > > Try this:
>
> > > TABLE(*[TR('T',INPUT(_type="checkbox",_name='T'))]+\
> > > [TR("Option "+str(opt), INPUT
> > > (_type="checkbox",_name=opt,value=False,_value='on')) for opt in
> > > options]+\
> > > [TR("",INPUT(_type="submit",_value="SUBMIT"))])
>
> > > On Dec 4, 9:02 pm, Maurice Ling <[EMAIL PROTECTED]> wrote:
>
> > > > Hi everyone,
>
> > > > I have an issue withmultiplecheckboxes which can only be defined at
> > > > runtime.
> > > > Here is my sample code:
>
> > > > options = range(5)
> > > > def multi_input():
> > > > form = FORM(
> > > > TABLE(TR('T',INPUT(_type="checkbox",_name='T')),
> > > > [TR("Option "+str(opt), INPUT
> > > > (_type="checkbox",_name=opt,value=False))
> > > > for opt in options],
> > > > TR("",INPUT(_type="submit",_value="SUBMIT"))))
> > > > opt_list = []
> > > > if form.accepts(request.vars,session):
> > > > ssession['form_vars'] = form.vars
> > > > redirect(URL(r=request,f='multi_out'))
> > > > return dict(form=form)
>
> > > > def multi_out(): return dict(result=session['form_vars'])
>
> > > > The list comprehension part ([TR("Option "+...for opt in options])
> > > > gave me the correct number of checkboxes. However, when I submit the
> > > > form, the information is not passed onto form.vars
>
> > > > For example, if I check "T", "Option 1" and "Option 2", I get
> > > > 1:
> > > > 2:
> > > > 3:
> > > > 4:
> > > > T:on
>
> > > > Any idea how to pass the 'on' value for "1" and "2"?
>
> > > > Thanks
> > > > Maurice
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---