Andy Pieters <[EMAIL PROTECTED]> wrote on 04/14/2005 12:55:20 PM:

> Hi all
> 
> I will first set out what I need and then why I need it.  Since I'm 
currently 
> implementing I can still change stuff.
> 
> I have a product input form that stores the information in a table.
> The product can be assigned different categories and what categories it 
is 
> assigned is saved in the product_categorized table by using the product 
key 
> AND the category key. This tecnhique is done to associate pictures and 
pages 
> with the product as well.
> 
> So
> 
> products table
> ->id
> 
> categories table
> ->id
> 
> pages table
> ->id
> 
> pictures table
> ->id
> 
> product_categorized
> ->id
> ->product id
> ->category id
> 
> product_pages
> ->id
> ->page_id
> 
> product_pictures
> ->id
> ->picture_id
> 
> 
> So far so good but there is one catch.  How to do this when there is no 
> product id yet?  That is when the user clicks on the link "add new 
product" 
> the come to the form which has amongs others, a link to "attach page", 
and 
> "attach product".
> 
> 
> I thank you in advance for your time and answers.
> 
> 
> With kind regards
> 
> 
> Andy Pieters
> 

You have to disable those links (or just not present them as options) 
until the user has filled in enough information to create a valid Product 
record. Otherwise you will end up with orphaned photos and pages. It's 
just as you think, you have to create a Product before you can create it's 
associated elements. This is something you should be able to control in 
your client-side code.  Once the user has filled in enough information to 
create a Product, you can "enable" the links to add pages or photos. When 
they click one of those links while on the form to create a Product, you 
first process the information they have entered and make a new Product 
record then you take them to the appropriate other page. The only 
difference between those buttons and the "save" button is which page the 
user winds up on after you process the click.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine


Reply via email to