Unless I am misunderstanding something, on the action page, the first thing you want to do is test to see if the user checked the check box.  If they did not, the form field for the check box will not be passed to the action page. So the first line of code would be:
 
<cfif IsDefined("form.CheckBoxName"")>
    Put your code here for handling the situation where the check box was passed in - meaning it was checked
<cfelse>
    Put the remainder of the page here including a <CFSET Form.CheckBoxName=1> to force the setting of the check box>
</cfif>   
 

Dave Cahall
Vice President, Professional Services
Digitaris Technologies, Inc.
Office: 972.690.4131 ext 116
Mobil: 214.914.9947

-----Original Message-----
From: Susan N. Klos [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 16, 2001 8:18 AM
To: DFWCFUG (E-mail)
Subject: Inserting records into a parent and child tables on the same acti on page

 
I have a form with a checkbox on it.  If the checkbox is checked the action page puts a not in the parent table and the user is redirected to another page.  If the user does not put a check in the box, they are supposed to fill out the rest of the form.  On this form are formfields which insert records in child tables as well as updating some information in the parent table.  I want the action page to:
 
Check to see if the first checkbox is checked
    if checked
        insert a record in the parent table
        put no in the appropriate field
        Send user to another page       
    If not checked
        insert a record
        put yes in the appropriate field
        Continue with the rest of the code on the page
 
Rest of code:
 
Insert into a child table putting the PK from the Parent table into the FK field of the child table
 
Update some fields on the Parent table
 
Insert into a child table putting the PK from the parent table into the FK field of the child table
 
I have gotten around this before by having the user submit the checkbox and then go on and submit the rest of the page.
 
Is there a way to do it all on one action page thereby only using one submit button?
 
 

Reply via email to