face this before, usually created the form with web2py components 1 for items (up first), save the value of items on the sessions then another component for order table (below to submit all the data (data in sessions input to items and order data)
during the form.process() or form.validate() first i insert the order table, then create a query to get the order table id, then assign it into items table. as a suggestion from people in here, this will create a race condition (which id will assign to items table when there is another person that input the order), good to use when your order table input that dont have high traffic or high transaction another way option 1: dont use the reference data type between order and items, just use the order field that unique, e.g. 'order_no' then assign it when generate the form, use the generated 'order_no' to items field table option 2: why not combine the table (order and items) into 1 table, do the looping during the insert for both of it best regards, stifan -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

