Erik,
 
What you want to do is retrieve the newly-inserted value from the database using the table's alternate key (which the user entered into the form).  Basically your action page will look something like this:
 
-----------------------------------
<cf_ValidateForm ...>
 ... server-side validation here ...
</cf_ValidateForm>
 
<cf_InsertRecord table="tablename" redirectTo="Nowhere">
 ... columns go here ...
</cf_InsertRecord>
 
<cfset newPrimaryKey = Application.DatabaseBlocks.GetRecord("pkcolumn", "tablename", "akcolumn = '#Form.akcolumn#'").pkcolumn>
 
<cflocation url="" addtoken="No">
-----------------------------------
 
HTH,
Dave
----- Original Message -----
From: Erik Myhre
Sent: Thursday, March 31, 2005 2:05 PM
Subject: [plum] How to get the primary key from cf_insertRecord?

Hey everyone,
Is there any way to get an auto generated primary key from the cf_insertrecord transaction? What I am trying to do is create a two step form. The first part creates a parent record, then I want the user to be able to add child records to that record that was just created.
 
Hope that makes sense...
Thanks!
 
 


Erik Myhre : Manager, Web Applications : 303-449-6444 x1112

Spectra Logic : 1700 N 55th Street Boulder, CO 80301 US

 

Reply via email to