On Mon, Feb 14, 2011 at 2:54 PM, rick <[email protected]> wrote: > I'd like to do something quite challenging (in my view) with web2py. > > I have a table (products), where each product has one or more codes. > The list of possible codes are stored in a separate table (codes), and > a third table (product_codes) stores the relationship(s) between the > product and the code(s). > > Why a third table?? Can you have many code for a product?
> I'd like a form that allows the user, on creating a new product, to > choose one or more codes for the product. I assume this would be using > checkboxes, pre-populated from the codes table. > > Upon submission, two tables are affected: the new product goes into > the product table, and one or more records into the product_codes > table. > > Is this possible? Is it possible using CRUD or SQLFORM? I'm at a loss > as to how to start this. > Thank you for your help, in advance. More information here : http://web2py.com/book/default/chapter/07#One-form-for-multiple-tables You will need to use computed and / or onvalidation, depending if use CRUD or SQLForm factory. It's not exactly what you want to do... I asked a similar question last week and Massimo wrote he has a piece of code for this : http://groups.google.com/group/web2py/browse_thread/thread/2c5e3c78664c5e9d?pli=1 I am interrested if you write something... Just publish your code. I will try to help you... Richard

