[web2py] Re: loop created forms

2012-05-15 Thread lucas
yes, thank you so much. i learned some very subtle things here and i love the way it works. thank you so much. web2py is so powerful and so cool.

[web2py] Re: loop created forms

2012-05-15 Thread Anthony
> > if ((request.vars._formname<>None) and > (request.vars._formname.rfind('opinion_')>-1)): > You don't have to explicitly check for not equal to None -- if it is None, it will evaluate to false. Also, does the formname start with "opinion_" -- if so, use .startswith(): if request.vars._

[web2py] Re: loop created forms

2012-05-15 Thread lucas
omg, that is so totally working. cool. i am almost there. i added this at the top of my function if ((request.vars._formname<>None) and (request.vars._formname.rfind('opinion_')>-1)): f = SQLFORM(db.lecture_item_opinions) f.vars.lecture_id=lecture.id f.vars.lecture_

[web2py] Re: loop created forms

2012-05-14 Thread pbreit
Oh, yeah, you're not going to want to have tons of forms but instead id each form.

[web2py] Re: loop created forms

2012-05-14 Thread Anthony
It's not the variable referring to the form that needs to be unique (you can simply append the forms together using CAT() or inside a DIV) -- rather, each form has a name stored in a hidden _formname field. It is set by specifying the "formname" argument to .accepts() or .processs(). f = SQLFOR

[web2py] Re: loop created forms

2012-05-14 Thread lucas
i did try messing around with f = SQLFORM(db.opinions) f.vars.stuff.assignments... exec 'f%s = %s' % (i.id, f) if (exec 'f%s' % i.id).process().accepted: session.flash = 'Thank you for your opinion'

[web2py] Re: loop created forms

2012-05-14 Thread lucas
sure i can us the id from the table of sections. but how to i attach that id number to a variable and python recognize that "string" as a variable name that i can then access again for the form processing? i guess this is more of a python question now then a web2py. lucas

[web2py] Re: loop created forms

2012-05-14 Thread Anthony
> > but how do i do that with soft-coded variable names when i don't know how > many DIV/sections i am going to have on a single page? or, what is the > best approach to soft-coding variable names in python to achieve that? > Is there something unique to each form? If so, use that to construct

[web2py] Re: loop created forms

2012-05-14 Thread lucas
yes, anthony, i knew of that section in the manual. an i see how and why it is done when you can hard-code the forms, giving them hard-coded variable names. but how do i do that with soft-coded variable names when i don't know how many DIV/sections i am going to have on a single page? or, wh

[web2py] Re: loop created forms

2012-05-14 Thread pbreit
So how would you do that in Python? Would you need to use vars()['form%s' % i] or can you do a list or dict of forms?

[web2py] Re: loop created forms

2012-05-14 Thread Anthony
Where's the logic for processing the form? Note, if you've got multiple forms on the same page, they each need a unique name -- see http://web2py.com/books/default/chapter/29/7#Multiple-forms-per-page. Anthony On Monday, May 14, 2012 10:12:30 AM UTC-4, lucas wrote: > > hello one and all, > > i