[web2py] need code to update db from view to controller.

2016-08-09 Thread madhu nomula
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.or

Re: [web2py] need code to update db from view to controller.

2016-08-09 Thread Kiran Subbaraman
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/th

Re: [web2py] need code to update db from view to controller.

2016-08-10 Thread madhu nomula
Yes totalrecords decalred. Updated the code like below in controller: But still throwing issue Controller code: @auth.requires_login() def update_timesheet(): totalrecords=0; rows = db((db.ActivityMapping.org_id==db.Organization.id)& (db.ActivityMapping.resource_id==db.auth_user.id)

Re: [web2py] need code to update db from view to controller.

2016-08-10 Thread Dave S
On Wednesday, August 10, 2016 at 3:52:20 AM UTC-7, madhu nomula wrote: > > Yes totalrecords decalred. > > Updated the code like below in controller: But still throwing issue > > What issue is thrown? Do you get a ticket, or wrong results? /dps -- Resources: - http://web2py.com - http://w

Re: [web2py] need code to update db from view to controller.

2016-08-11 Thread madhu nomula
I am unable to update . In view its throwing issue: only row.update_record() code throwing error. unable to capture in view Please let me know if there is any issue below code: def update_timesheet(): totalrecords=0; i=0; rows = db( (db.ActivityMapping.resource_id==db.auth_use

Re: [web2py] need code to update db from view to controller.

2016-08-11 Thread Massimiliano
Doesn’t update_records belong to *row* instead of *rows*? On Thu, Aug 11, 2016 at 2:10 PM, madhu nomula wrote: > I am unable to update . > > In view its throwing issue: only row.update_record() code throwing > error. unable to capture in view > > Please let me know if there is any issue below co

Re: [web2py] need code to update db from view to controller.

2016-08-11 Thread Kiran Subbaraman
From the documentation (link I provided earlier): "The update_record method is available only if the *table's id field is included in the select*, and cacheable is not set to True." Your select does not include the table's id field. In your case, that would be `db.ActivityMapping.id` ... I guess