In the following controller when edit a row and submit, 
request.vars.survey_id changes from '3'  to ['3', '3']
but not if I click on 'Back'  without editing.  Why?

I had to use the following workaround: 

     survey_id = request.vars.survey_id[0] if isinstance(survey_id, list) 
else request.vars.survey_id 


@auth.requires_login()
def edit_survey():
     response.view = 'default/survey_create.html'
     survey_id = request.vars.survey_id
     if isinstance(survey_id, list):
         survey_id = survey_id[0]
     survey = db.survey[survey_id]
     db.questions.id.readable = False
     if survey_id:
         query = db.questions.survey_id== survey_id
         fields = [db.questions.question_number,
                   db.questions.question,db.questions.answer_type,
                   db.questions.id]
         questions = SQLFORM.grid(query,
                                  editable = True,
                                  deletable = True,
                                  create = True,
                                  searchable = False,
                                  maxtextlength = 100,
                                  orderby=db.questions.question_number)
         header = H3(T('%s for editing' % db.survey[survey_id].name))
     else:
         header = H3(T('No valid survey selected'))
         form = ''
     return dict(header = header, form = questions)

Regards
Johann

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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.

Reply via email to