When i try this method the Item_Request fills in the ID as None

On Saturday, April 16, 2016 at 5:09:39 PM UTC+1, Richard wrote:
>
> Hello Jack,
>
> You mean you want to pass the id of the inserted record to another 
> controller ?
>
> # Controller form 1
> if form.process(dbio=False).accept:
>     id = db.table.insert(**forms.vars)
>     session.last_record_id = id
>
> In the next controller you can access the id you store in session
> # Controller form 2
> session.last_record_id  # contains the previous inserted record id
>
> Watchout as session will keep last_record_id for the during of it... So 
> you may need to clean it (delete last_record_id from session after second 
> controller complete process) to make sure you are always refering to the 
> proper id...
>
> Richard
>
>
>
> On Sat, Apr 16, 2016 at 2:19 AM, Dave S <snide...@gmail.com <javascript:>> 
> wrote:
>
>>
>>
>> On Friday, April 15, 2016 at 9:53:35 PM UTC-7, Jack Lodge wrote:
>>>
>>> Im trying to make a Order system for my alevel course work and when im 
>>> filling in some forms i make a *Request* then i redirect the user to 
>>> the *Item_Request* form to fill in the details there, i need to be able 
>>> to get the id of the Request that they just submitted so i can populate the 
>>> Item_Request Table.
>>>
>>> I am using Pythonanywhere and web2py
>>>
>>> how would i do this?
>>>
>>
>> One way would be for the item form to record in the session the id 
>> returned by its add operation .  The order form would then look up that id 
>> in the session.
>>
>> /dps
>>
>> -- 
>> 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+un...@googlegroups.com <javascript:>.
>> 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