I've been working with web2py for about two months now.  I've figured out 
how to do a lot of awesome things with it; however, the problem I'm having 
now has me stumped.

I'm working on an application that allows a user to submit a 
self-evaluation, based on criteria that the user will find on a page.  I 
have a table with 33 rows of of criteria.  The table contains a column 
which hosts the criteria, pre-formatted in HTML.  Each HTML section 
contains a table the gives the users the criteria for each of six levels - 
these individual tables are almost large enough to take up the entire 
content section of the webpage, so I've placed them all in a jQuery 
accordion.  Below each table, I've placed a drop down list, where the user 
can select what criteria they feel as though they've met.  I've added a 
small screenshot to show the look and feel I'm trying to achieve (and 
currently have).

The problem I'm having is getting the values of those drop down lists back 
from the database.  Currently, I iterate through the table containing the 
HTML using a for loop, tacking a drop down list at the end of each.  Right 
now, I'm unable to get the data back from the page.  Here is my code:

def Take_Eval(): 
    user = db(db.Person.auth_userUserId == 
auth.user.id).select().first().PersonId
    table = db(db.PageContent.ContentId > 0).select()
    submit = INPUT(_name='submit', _type='submit')
    formlist = []
    
    for row in table:
        newForm = FORM(H2(row['ContentDescription'], _style="padding-left: 
10px;"),
        DIV(XML(row.ContentHTML), BR(), P(SELECT(OPTGROUP(OPTION('Does not 
Attempt', _value=0), OPTION('Developing', _value=1), OPTION('Progressing', 
_value=2), OPTION('Established', _value=3), OPTION('Advanced', _value=4), 
OPTION('Master', _value=5)), _id=row['QuestionNumber']), 
_style='text-align: center;')))
        formlist.append(newForm)
    
    for form in formlist:
        if form.accepts(request, session):
           response.flash = 'Profile Saved Successfully on  ' + 
str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
       #db.Evaluation.insert(PersonBeingEvaluated, PersonEvaluating, 
EvalDate ,1_1A ,1_1B ,1_2 ,1_3 ,1_4 , 1_5, 1_6, 2_1, 2_2A , 2_2B, 2_3A 
,2_3B ,2_4 ,2_5 ,3_1 , 3_2 , 3_3, 3_4, 3_5A, 3_5B, 3_6, 3_7, 3_8, 3_9A, 
3_9B, 3_9C, 4_1, 4_2, 4_3A, 4_3B, 4_4, BeliefsScore, CharacterScore)
           
           redirect(URL('default', 'index'))
        elif form.errors:
           response.flash = 'Profile could not be submitted.  Please try 
again later. '
    
    db.Evaluation.insert(PersonBeingEvaluated=user, PersonEvaluating=0, 
EvalDate=datetime.now(), 1_1A = formlist[0].vars.1_1A, 1_1B = 
formlist[1].vars.1_1B, 1_2 = formlist[2].vars.1_2, 1_3 = 
formlist[3].vars.1_3, 1_4 = formlist[4].vars.1_4, 1_5 = 
formlist[5].vars.1_5, 1_6 = formlist[6].vars.1_6, 2_1 = 
formlist[7].vars.2_1, 2_2A = formlist[8].vars.2_2A, 2_2B = 
formlist[9].vars.2_2B, 2_3A = formlist[10].vars.2_3A, 2_3B = 
formlist[11].vars.2_3B, 2_4 = formlist[12].vars.2_4, 2_5 = 
formlist[13].vars.2_5, 3_1 = formlist[14].vars.3_1, 3_2 = 
formlist[15].vars.3_2, 3_3 = formlist[16].vars.3_3, 3_4 = 
formlist[17].vars.3_4, 3_5A = formlist[18].vars.3_5A, 3_5B = 
formlist[19].vars.3_5B, 3_6 = formlist[20].vars.3_6, 3_7 = 
formlist[21].vars.3_7, 3_8 = formlist[22].vars.3_8, 3_9A = 
formlist[23].vars.3_9A, 3_9B = formlist[24].vars.3_9B, 3_9C = 
formlist[25].vars.3_9C, 4_1 = formlist[26].vars.4_1, 4_2 = 
formlist[27].vars.4_2, 4_3A = formlist[28].vars.4_3A, 4_3B = 
formlist[29].vars.4_3B, 4_4 = formlist[30].vars.4_4, BeliefsScore = 
formlist[31].vars.BeliefsScore, CharacterScore = 
formlist[32].vars.CharacterScore)
          
    return locals()


The code is not letting me compile due to a syntax error on the area I've 
highlighted above.  I'm okay with not using a form, or a bunch of forms, as 
long as I can get the values from the drop down list back to the controller 
when the submit button is clicked.  I originally looped through the table 
in the view to make the display.  Each drop down has a unique name that I'd 
be able to access in the controller, but I haven't been able to figure out 
how to do that only after post back.  I appreciate any guidance that could 
be given.  Thanks!

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


<<attachment: tesscreenshot.png>>

Reply via email to