Hello Kevin ,

 Thanks a lot for your reply.

what i want to do is :

def items():
    wo =  db(db.WO.id == request.vars.wo_id).select()[0]
    checkList_items = db(db.checklist_item.cl_id ==
request.vars.cl_id).select(orderby="checklist_item.id DESC")
    form = SQLFORM(SQLDB(None).define_table('myform',
           db.WO.project_title,
           db.WO.project_manager
           ),submit_button=T("save"))
    form.vars.project_title = wo.project_title
    form.vars.project_manager = wo.project_manager
    count = 4
    for item in checkList_items:
 
form[0].insert(count,TR(TD(item.id),TD(item.item),TD(INPUT(_type='radio',_value="NA"
 ,
_name=item.id 
,_class="answer_class",_id="answer_options"+str(item.id)),_colspan=1),TD(INPUT(_type='radio',_value='YES'
 ,
_name=item.id 
,_class="answer_class",_id="answer_options")),TD(INPUT(_type='radio',_value='NO'
 ,
_name=item.id 
,_class="answer_class",_id="answer_options"),TD(INPUT(_type='text',_id='comment',_name="comment"+str(item.id))))))
    if form.accepts(request.vars, session):
        for item in checkList_items:
            try:
                if request.vars[str(item.id)]:
                    if request.vars[str(item.id)] == "NO" and
request.vars["comment"+str(item.id)] == "":
                        session.flash = "Error"
                        #return dict(form=request.vars)
                        form.vars = request.vars
 
#redirect(URL(r=request,f='items',vars=request.vars)) ## Here
redirected to empty from How can i fix this
                        return dict(form=form)
                    else:
 
db.answers.insert(field_clI_id=request.vars.fCL_id,clI_id=item.id,answer=request.vars[str(item.id)],comment=request.vars["comment"+str(item.id)])
                        redirect(URL(r=request,f='view'))
            except KeyError:
                print "Error KeyValue"
 
db.answers.insert(field_clI_id=request.vars.fCL_id,clI_id=item.id,answer='None')
                redirect(URL(r=request,f='view'))
    return dict(form=form)





On Mar 20, 6:08 pm, Kevin Ivarsen <kivar...@gmail.com> wrote:
> Hi Neveen,
>
> Without a bit more context I'm having trouble determining the problem. In
> principle you should be able to pass vars=request.vars to URL and have them
> show up in the redirected URL. For example:
>
> def func1():
>     if request.vars.value == "hello":
>         return "you submitted hello"
>     else:
>         redirect(URL('func2', vars=request.vars))
>
> def func2():
>     return BEAUTIFY(request.vars)
>
> If you go to "/app/controller/func1?name=Bob" you will be redirected
> to /app/controller/func1?name=Bob, and request.vars will include a
> .name='Bob' attribute.
>
> If you go to "/app/controller/func2?name=Bob&value=hello" you'll stay at
> func1 and see "you submitted hello".
>
> Try starting with that example, verifying that it works for you, and then
> extending it to do what you need.
>
> If you could describe a little more about what you are trying to do, and/or
> include a bit more of the code you're working with, I might be able to
> provide more help. There may be a better way to do this already built in to
> web2py.
>
> Cheers,
> Kevin

Reply via email to