Hi ,

In Web2 py tool 

need sample code to update db table(module) from View value to ---> 
Controller code for updating:


View code
:
ajax('{{=URL('update_data')}}',['org_id','solution_id','activity_id','effort'],'target');


Controller code:

def update_data():
    
    for u in request.vars.org_id:
        totalrecords=totalrecords+1
   
    
    if totalrecords == 1:
        
db.ActivityMapping.update_record(resource_id=auth.user.id,org_id=int(request.vars.org_id),solution_id=int(request.vars.solution_id),activity_id=int(request.vars.activity_id),effort=int(request.vars.effort))
    elif totalrecords>1:
        for m in request.vars.org_id:
            #e= e+ ' org: ' + str(m) + ' act: '+ 
str(request.vars.activity_id[i]) + ' soln: ' + 
str(request.vars.solution_id[i]) +' effort: '+str(request.vars.effort)
            
db.AM.update(resource_id=auth.user.id,org_id=int(m),solution_id=int(request.vars.solution_id[i]),activity_id=int(request.vars.activity_id[i]),effort=int(request.vars.effort[i]))
            i=i+1

    return locals()


Facing issue with above code,.

Regards,
MC

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to