Quantcast
Channel: Adobe Community : All Content - ColdFusion
Viewing all articles
Browse latest Browse all 5979

Single CF Form to Add "x" Number of Voice & Data (Related) Records

$
0
0

I have an older functioning form that creates a new "Order" record in my "tblCOM" table

Add_x_number_of_records.PNG

 

I added two new text type fields called: "HowManyData" & "HowManyVoice" (see image above) and a new field called "pvType"

 

Question: How can I adapt my page to handle the following scenario:

---------------------------------------------------------------------- ---------------------

- the user types in a qty of "4" for field "HowManyData"

- the user types in a qty of "2" for field "HowManyVoice"

 

When the Submit button is pressed:

-----------------------------------------------

- the main record is added to "tblCOM" (this is already working fine)

- four (4) related  "Data" records are added to the "tblProvisioning" table (and pvType is saved w/value of "Data")

- four (2) related "Voice" records are added to the "tblProvisioning" table (and pvType is saved w/value of "Voice")

 

 

I know this requires something similar to the following:

---------------------------------------------------------------------- -

<cfquery name="simpleInsert" datasource="mydatasource">
INSERTINTO tblProvisioning (col1,col2,col3)
VALUES
<cfloop from="1"to="5"index="i">
<cfif i GT 1>,</cfif>
(#i#,'somename','sometitle')
</cfloop>
</cfquery>

 

 

tblCOM table

------------------

- omID (integer auto-increment ID)

- etc..

 

tblProvisioning table

---------------------------

- pvNum (integer auto-increment ID)

- pvwoNum (integer foreign key from tblCOM)

- pvType (varchar for Data or Voice)

- pvDate (current_timestamp)


Viewing all articles
Browse latest Browse all 5979

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>