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_item_id=request.vars._formname.rsplit('_')[1]
        f.vars.user_id=auth.user_id
        if f.process(formname=request.vars._formname).accepted:
            session.flash = 'Thank you for your opinion 
'+request.vars._formname
        elif f.process(formname=request.vars._formname).errors:
            response.flash = 'errors'

and it is inserting the data into the postgresql table.  great.  but the 
form is displaying the standard "Success!" and not the one i have above.  
how come?  i also tried it without an arguement in process.


On Monday, May 14, 2012 10:32:25 PM UTC-4, Anthony wrote:
>
> 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 = SQLFORM(db.opinions)
> [more code]
> f.process(formname='myform_%s' % i.id)
>
> When you create the forms, you can do so in a loop and append them all 
> together. However, when a specific form is submitted, you don't want to 
> create and process all the forms again because you only need to create and 
> process the submitted form. So, check for request.vars._formname, and if 
> present, just create and process that one form (use the value in 
> request.vars._formname to set the "formname" argument in the call to 
> .process()).
>

Reply via email to