Need convert request to int:
int(request.post_vars.pid)

Fabiano.


2014-07-02 8:05 GMT-03:00 Shubham Jain <shub.jain1...@gmail.com>:

> 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.
>

-- 
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.

Reply via email to