In the controller, is your code entering the `if` checks? And am
guessing the totalrecords is initialized before you do a
`totalrecords=totalrecords+1`?
Noticed that you are using `update_record` and `update` in your code. Do
take a look at this:
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=update_record#update_record
________________________________________
Kiran Subbaraman
http://subbaraman.wordpress.com/about/
On Tue, 09-08-2016 10:43 PM, madhu nomula wrote:
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 web2py+unsubscr...@googlegroups.com
<mailto:web2py+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.
--
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/d/optout.