The problem is that here: testform = SQLFORM(db.products,db(db.products.product_id==request.post_vars.pid).select(), fields=['product_id','price','pro_type','tags','category','description']))
the result of a select is a Rows and not a Row. Do you know there is a single matching record? In this case: testform = SQLFORM(db.products,db(db.products.product_id==request.post_vars.pid).select().first(), fields=['product_id','price','pro_type','tags','category','description'])) or testform = SQLFORM(db.products, db.products(product_id=request.post_vars.pid), fields=['product_id','price','pro_type','tags','category','description'])) Mind that the pid of the product you want to edit should not be a POST parameter but a GET parameter. According to REST it is used to identify the resource you want to edit therefore it belongs to the URL not to the posted data. Massimo On Wednesday, 2 July 2014 06:05:31 UTC-5, Shubham Jain wrote: > > I want to create an update page just like profile page in default > application. Actually I am passing the primary key of a table by a button > click to the product_update page. In the controller of the update page I > tried these 2 codes. > > def product_edit(): > db.products.product_id.writable=FALSE # to make product_id > non editable > db.products.product_id.readable=TRUE > testform = > SQLFORM(db.products,db(db.products.product_id==request.post_vars.pid).select(), > fields=['product_id','price','pro_type','tags','category','description'])) > return dict(form=testform) > > > > --------------OR--------------------------------------------------------------------------------- > > dform = > SQLFORM(db.products,record=db(db.products.product_id==request.post_vars.pid).select(), > > fields=['product_id','price','pro_type','tags','category','description']) > return dict(form=dform) > > pid - name of the input which has the product_id. > But these don't work. > > Error Generated: TypeError: list indices must be integers, not str > > -- 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.