I am not sure about what you are doing. Why do you have one form per row 
that does not submit any data other than a hidden field with id? What is 
the purpose of that submission?






On Thursday, 3 July 2014 05:03:19 UTC-5, Shubham Jain wrote:
>
> And I didn't understand why should I pass the 'pro_id' by GET and not by 
> POST. This is the view from where I am passing the parameter (using POST)
>
> {{for row in rows:}}
>         <tr>
>           <td>{{=x}}{{x=x+1}}</td>
>             <td>{{=row.product_id}}</td>
>             <!-- EDIT -->
>             <td><form action="{{=URL('pro_edit')}}" method="post">
>                 <input name="pid" value="{{=row.product_id}}" type="hidden">
>                 <input type="submit" value="Edit">
>                 </form></td>
>        <tr> {{pass}}
>
>  Please tell me if I am wrong somewhere.
>
> 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.

Reply via email to