Insert Multiple Parts Problem | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| |
Hey Everyone,
Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple fields for the not only the serial section but also the parts section an i seem to be having trouble.
When i try to insert into the parts section i get the error Invalid character value for cast specification. But not sure what i am doing wrong. Here is what i am using to insert. All the sections below work except the.Inserts parts information into parts table section. - <!---Inserts information into serial table.--->
-
<CFIF REQUEST_METHOD EQ "POST">
-
<CFSET machineListLen = listLen(Form.serialcount)>
-
<CFLOOP from="1" to="#machineListLen#" index="machineCount">
-
<CFSET serialnum = Form["serialnum_" & machineCount]>
-
<CFSET modelno = Form["modelno_" & machineCount]>
-
<CFSET producttype = Form["producttype_" & machineCount]>
-
<CFSET softhardware = Form["softhardware_" & machineCount]>
-
<CFSET resolution = Form["resolution_" & machineCount]>
-
<CFSET resdate = Form["resdate_" & machineCount]>
-
<CFSET resvertified = Form["resvertified_" & machineCount]>
-
<CFSET vertifidate = Form["vertifidate_" & machineCount]>
-
<CFSET deptvendor = Form["deptvendor_" & machinecount]>
-
<CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
-
<CFSET rma = Form["rma_" & machineCount]>
-
<CFSET thedescription = Form["thedescription_" & machineCount]>
-
<CFSET hcpn = Form["hcpn_" & machineCount]>
-
<CFSET partsreturn = Form["partsreturn_" & machineCount]>
-
<CFSET defective = Form["defective_" & machineCount]>
-
<!--- <CFSET followdate = Form["followdate_" & machineCount]>
-
<CFSET onsite = Form["onsite_" & machineCount]>
-
<CFSET numonsite = Form["numonsite_" & machineCount]>--->
-
-
<cfquery name="serial" datasource="CustomerSupport">
-
exec usp_CS_Insertserial
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#resdate#">,
-
<cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#vertifidate#">,
-
<cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">
-
</cfquery>
-
-
<!---Inserts information into notes_descr table.--->
-
<cfquery name="description" datasource="CustomerSupport">
-
exec usp_CS_Insertdescription
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.fk_addedBy#'
-
</cfquery>
-
-
<!---Inserts parts information into parts table.--->
-
<!---because it is a bit we don't use 'ticks' around defective for parts table--->
-
<cfquery name="parts" datasource="CustomerSupport">
-
exec usp_CS_Insertparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
-
<!--- <cfquery param value="#submission#" CFSQLType = "CF_SQL_VARCHAR">--->
-
</cfquery>
-
-
</CFLOOP>
-
</CFIF>
-
here is the multiple fields section in my form for the serial section.
here is the multiple field section for the parts section - <!---Allows us to add PARTS information multiple times--->
-
<script type="text/javascript">
-
<!---Adds multiple fields for parts --->
-
function addpartInput(partName){
-
var parts = document.getElementById(partName);
-
var getparts = document.getElementById('div');
-
var serialno = partName.replace("dynamic","").replace("Input","");
-
var avalue = document.getElementById("partscount"+serialno);
-
var count = parseInt(avalue.value) + 1;
-
avalue.value = count;
-
var partdiv = document.createElement('div');
-
var partIdName = 'part' + count + 'Name' + serialno;
-
-
partdiv.setAttribute('id',partIdName);
-
-
<!--- Adds Extra fields for parts table --->
-
partdiv.innerHTML =
-
<!---what used originally for this tableclass='createticketables' id='spaceup'--->
-
"<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' >" +
-
"<th class='sectiontitle' colspan='7'>Parts Information "+ count +" Serial Information "+serialno+"</th>" +
-
"<tr>" +
-
"<td class='indent' id='formfieldpadding'>HC P/N: <input type='text' name='hcpn_" + count + "' style='margin:0px'></td>" +
-
"<td class='red'>" +
-
"Parts been returned* " +
-
"<input type='checkbox' name='partsreturn_" + count +"' value='1'/>" +
-
"</td>" +
-
"<td>" +
-
"<td class='indent'>Defective<input type='checkbox' name='defective_" + count +"' value='1'/></td>" +
-
"</td>" +
-
"</tr>" +
-
"</table>" +
-
"<table table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' >" +
-
"<tr>" +
-
"<td class='indent' id='formfieldpadding'>Follow up Date:(MM/DD/YYYY) " +
-
"<input type='text' name='followdate_" + count + "' value='' size='8'/> " +
-
"Current Date<input type='checkbox' name='followcheck_"+ count +"' value='' onClick='followdate.value=fill_date()'/></td>" +
-
"<td>On Site:</td>" +
-
"<td><select name='onsite_" + count +"'>" +
-
"<option value='No Choice' selected>No Choice</option>" +
-
"<option value='Yes'>Yes</option>" +
-
"<option value='No'>No</option>" +
-
"</select><td>" +
-
"<td># of Onsite:</td><td><select name='numonsite_" + count +"'>" +
-
"<option value='' selected>No Choice</option>" +
-
"<cfloop from='0' to='10' index='nonsite'><cfoutput>" +
-
"<option value='#nonsite#'>#nonsite#</option></cfoutput></cfloop>" +
-
"</select><td>" +
-
"</tr>" +
-
"</table>" +
-
<!---"<input type='hidden' value='0' id='aValue' />" +--->
-
"<input type='hidden' name='serialcount' value='" + count + "'>";
-
-
-
<!--- Adds Delete to every ticket --->
-
partdiv.innerHTML = partdiv.innerHTML +
-
"<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
-
"<tr>" +
-
"<td>" +
-
"<input type='button' class='removeticket' value='Remove Parts ""+count +""' onclick=\"removetheElement(\'"+partIdName+"\')\"></a>" +
-
"</td>" +
-
"</td>" +
-
"</tr>" +
-
"</table>";
-
-
document.getElementById(partName).appendChild(partdiv);
-
}
-
-
<!---Allows us to remove multiple fields--->
-
function removetheElement(divNum) {
-
var d = document.getElementById('partsInput');
-
var olddiv = document.getElementById(divNum);
-
olddiv.parentNode.removeChild(olddiv);
-
}
-
-
</script>
Thank you in advance,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
Since you can have multiple parts per serial, you need to use the part-counts in each serial to loop over (as you've done with serial-count) to add parts to each serial.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder Since you can have multiple parts per serial, you need to use the part-counts in each serial to loop over (as you've done with serial-count) to add parts to each serial.
Hey Acoder,
So would something like this work?
used for serial and description - <!---Inserts information into serial table.--->
-
<CFIF REQUEST_METHOD EQ "POST">
-
<CFSET machineListLen = listLen(Form.serialcount)>
-
<CFLOOP from="1" to="#machineListLen#" index="machineCount">
-
<CFSET serialnum = Form["serialnum_" & machineCount]>
-
<CFSET modelno = Form["modelno_" & machineCount]>
-
<CFSET producttype = Form["producttype_" & machineCount]>
-
<CFSET softhardware = Form["softhardware_" & machineCount]>
-
<CFSET resolution = Form["resolution_" & machineCount]>
-
<CFSET resdate = Form["resdate_" & machineCount]>
-
<CFSET resvertified = Form["resvertified_" & machineCount]>
-
<CFSET vertifidate = Form["vertifidate_" & machineCount]>
-
<CFSET deptvendor = Form["deptvendor_" & machinecount]>
-
<CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
-
<CFSET rma = Form["rma_" & machineCount]>
-
<CFSET thedescription = Form["thedescription_" & machineCount]>
-
<!--- <CFSET followdate = Form["followdate_" & machineCount]>
-
<CFSET onsite = Form["onsite_" & machineCount]>
-
<CFSET numonsite = Form["numonsite_" & machineCount]>--->
-
-
<cfquery name="serial" datasource="CustomerSupport">
-
exec usp_CS_Insertserial
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#resdate#">,
-
<cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#vertifidate#">,
-
<cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">
-
</cfquery>
-
-
<!---Inserts information into notes_descr table.--->
-
<cfquery name="description" datasource="CustomerSupport">
-
exec usp_CS_Insertdescription
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.fk_addedBy#'
-
</cfquery>
-
</CFLOOP>
-
</CFIF>
-
used for the parts section - <!---Inserts parts information into parts table.--->
-
<!---because it is a bit we don't use 'ticks' around defective for parts table--->
-
<CFIF REQUEST_METHOD EQ "POST">
-
<CFSET machineListLen = listLen(Form.partscount)>
-
<CFLOOP from="1" to="#machineListLen#" index="machineCount">
-
<CFSET hcpn = Form["hcpn_" & machineCount]>
-
<CFSET partsreturn = Form["partsreturn_" & machineCount]>
-
<CFSET defective = Form["defective_" & machineCount]>
-
-
-
<cfquery name="parts" datasource="CustomerSupport">
-
exec usp_CS_Insertparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
-
<!--- <cfquery param value="#submission#" CFSQLType = "CF_SQL_VARCHAR">--->
-
</cfquery>
-
</CFLOOP>
-
</CFIF>
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
That wouldn't necessarily work because there are multiple counts for parts, so you would need to get each parts count and loop over that number of times for each serial.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder That wouldn't necessarily work because there are multiple counts for parts, so you would need to get each parts count and loop over that number of times for each serial. Hey Acoder,
I hate to say it but i am completely lost by what you mean. This is how i have it right now - <!---Inserts information into serial table.--->
-
<CFIF REQUEST_METHOD EQ "POST">
-
<CFSET machineListLen = listLen(Form.serialcount)>
-
<CFLOOP from="1" to="#machineListLen#" index="machineCount">
-
<CFSET serialnum = Form["serialnum_" & machineCount]>
-
<CFSET modelno = Form["modelno_" & machineCount]>
-
<CFSET producttype = Form["producttype_" & machineCount]>
-
<CFSET softhardware = Form["softhardware_" & machineCount]>
-
<CFSET resolution = Form["resolution_" & machineCount]>
-
<CFSET resdate = Form["resdate_" & machineCount]>
-
<CFSET resvertified = Form["resvertified_" & machineCount]>
-
<CFSET vertifidate = Form["vertifidate_" & machineCount]>
-
<CFSET deptvendor = Form["deptvendor_" & machinecount]>
-
<CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
-
<CFSET rma = Form["rma_" & machineCount]>
-
<CFSET thedescription = Form["thedescription_" & machineCount]>
-
<CFSET hcpn = Form["hcpn_" & machineCount]>
-
<CFSET partsreturn = Form["partsreturn_" & machineCount]>
-
<CFSET defective = Form["defective_" & machineCount]>
-
<!--- <CFSET followdate = Form["followdate_" & machineCount]>
-
<CFSET onsite = Form["onsite_" & machineCount]>
-
<CFSET numonsite = Form["numonsite_" & machineCount]>--->
-
-
<cfquery name="serial" datasource="CustomerSupport">
-
exec usp_CS_Insertserial
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#resdate#">,
-
<cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#vertifidate#">,
-
<cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">
-
</cfquery>
-
-
<!---Inserts information into notes_descr table.--->
-
<cfquery name="description" datasource="CustomerSupport">
-
exec usp_CS_Insertdescription
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.fk_addedBy#'
-
</cfquery>
-
-
-
<!---Inserts parts information into parts table.--->
-
<!---because it is a bit we don't use 'ticks' around defective for parts table--->
-
<cfquery name="parts" datasource="CustomerSupport">
-
exec usp_CS_Insertparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
-
<!--- <cfquery param value="#submission#" CFSQLType = "CF_SQL_VARCHAR">--->
-
</cfquery>
-
</CFLOOP>
-
</CFIF>
Are you saying to do 2 cfloops one for serial (Iike i have now) an then add another cfloop for parts? would i then only put it around the parts section or all of the code like above? just confused on what i need to get
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
Yes, two cfloops and the second one only around parts looping from 1 to partscount1,2,3,etc. where 1,2,3 would be the current serial count.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder Yes, two cfloops and the second one only around parts looping from 1 to partscount1,2,3,etc. where 1,2,3 would be the current serial count. Hey Acoder,
so would i do the loop like this? was not sure what to put in to=. - <cfloop from="1" to="partc">
-
<cfquery name="parts" datasource="CustomerSupport">
-
exec usp_CS_Insertparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
-
<!--- <cfquery param value="#submission#" CFSQLType = "CF_SQL_VARCHAR">--->
-
</cfquery>
-
</cfloop>
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
The "to" attribute would need to be set to the parts count variables, e.g. #partscount# where #partscount# could be set in the line before to the form variable passed from the client-side.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder The "to" attribute would need to be set to the parts count variables, e.g. #partscount# where #partscount# could be set in the line before to the form variable passed from the client-side. Hey Acoder,
Ok i am lost in my serial function i have this line - "<input type='hidden' value='0' id='"+partc+"' \>" +
do i need to give this line a name an then put whatever the name i put for this line in the "to" for the cfloop?
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
Yes, it also needs a name. Note that partc is not the ID/name - it's the variable holding the string value which you set earlier in the function.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder Yes, it also needs a name. Note that partc is not the ID/name - it's the variable holding the string value which you set earlier in the function. Hey Acoder,
Ok so like this - "<input type='hidden' value='0' name="partscount" id="partscount" value='"+partc+"' \>" +
an then do i use the name in the "to" on my cfloop?
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
No, don't set the name/ID to "partscount". Set it to partc as you had before (same for both ID and name. Note also that you now have two values (which is also incorrect). You need something like: - name='"+partc+"' id='"+partc+"'
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder No, don't set the name/ID to "partscount". Set it to partc as you had before (same for both ID and name. Note also that you now have two values (which is also incorrect). You need something like: - name='"+partc+"' id='"+partc+"'
Hey Acoder,
So like this - "<input type='hidden' name='"+partc+"' id='"+partc+"' value='"+partc+"' \>" +
an then for the to in the cfloop i call '"+partc+"' correct?
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
The value has to be a number, 0 initially. Look at what partc is set to (look earlier in the function, not sure which line). That's what Coldfusion will see. To see what this turns out in the browser, check the generated source in the browser and you will see that the name and ID are set to "partscount1" or "partscount2", etc. depending on the serial number. This is what is required in the cfloop.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder The value has to be a number, 0 initially. Look at what partc is set to (look earlier in the function, not sure which line). That's what Coldfusion will see. To see what this turns out in the browser, check the generated source in the browser and you will see that the name and ID are set to "partscount1" or "partscount2", etc. depending on the serial number. This is what is required in the cfloop. Hey Acoder,
So your saying it needs 'partscount'+count (which is what partc is set to) in the "to" in the cfloop ?
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
Yes, with 'count' being the serial number.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder Yes, with 'count' being the serial number. Hey Acoder,
So something like this correct? - <cfloop from="1" to="'partscount'+serialcount">
-
<cfquery name="parts" datasource="CustomerSupport">
-
exec usp_CS_Insertparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
-
<!--- <cfquery param value="#submission#" CFSQLType = "CF_SQL_VARCHAR">--->
-
</cfquery>
-
</cfloop>
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
Not quite. It'd have to be a Coldfusion form variable like the serial count for the first loop.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder Not quite. It'd have to be a Coldfusion form variable like the serial count for the first loop. Hey Acoder,
So what would i use because i don't have any hidden fields in the parts function.
an all i have in the serial function is - "<input type='hidden' name='"+partc+"' id='"+partc+"' value='0' \>" +
-
"<input type='hidden' name='serialcount' id='serialcount' value='" + count + "'>";
an then is what i have for the html - <input type="hidden" value="0" id="theValue" name="theValue"/>
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
You don't need any in the parts function because the one(s) in the serial function is/are the count(s) for parts. What I suggest you do is turn on debugging so you can see what's being passed to your Coldfusion script. You should see all the form element names and values.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder You don't need any in the parts function because the one(s) in the serial function is/are the count(s) for parts. What I suggest you do is turn on debugging so you can see what's being passed to your Coldfusion script. You should see all the form element names and values. Hey Acoder,
So are you saying i need to pass serialcount in my cfloop?
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
The serialcount would be required to construct the form element name:
form["partscount" & serialcount]
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder The serialcount would be required to construct the form element name:
form["partscount" & serialcount] Hey Acoder,
When i tried this i got the error
Attribute TO in tag CFLOOP has an invalid value
Cannot convert form['partscount'&serialcount] to number. - <cfloop from="1" to="form['partscount'&serialcount]">
an when i tried this it was having issues with the " - <cfloop from="1" to="form["partscount"&serialcount]">
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
That's a Coldfusion variable, so it has to be within ##
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder That's a Coldfusion variable, so it has to be within ## Hey Acoder,
Does the serialcount or the partscount need to be in ##? an does partscount still need '' around it? - <cfloop from="1" to="form['partscount' & #serialcount#]">
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
The whole thing: #form[...]#
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder The whole thing: #form[...]# Hey Acoder,
its having issues with the cfloop. was not earlier for some reason but i am now. it says
Attribute set validation error in tag CFLOOP
The tag has an invalid attribute combination: the most likely attribute combination is
Required attributes: 'FROM,INDEX,TO'. Optional attributes: 'STEP'. - <cfloop from="1" to="#form['partscount' & serialcount]#">
-
<cfquery name="parts" datasource="CustomerSupport">
-
exec usp_CS_Insertparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
-
<!--- <cfquery param value="#submission#" CFSQLType = "CF_SQL_VARCHAR">--->
-
</cfquery>
-
</cfloop>
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
You forgot the index attribute - see the first cfloop.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder You forgot the index attribute - see the first cfloop. Hey Acoder,
It works perfectly for inserting only one serial and one part. But when i tried more i got the following error
An error occurred while evaluating the expression:
"#form['partscount' & serialcount]#"
Error near line 95, column 27.
--------------------------------------------------------------------------------
The member "PARTSCOUNT1,2" in dimension 1 of object "form" cannot be found. Please, modify the member name.
an well line 95 is the cfloop. - <cfloop from="1" to="#form['partscount' & serialcount]#" index="machineCount">
-
<cfquery name="parts" datasource="CustomerSupport">
-
exec usp_CS_Insertparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">,
-
'#Form.submission#'
-
</cfquery>
-
</cfloop>
-
Thank you :),
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
Right, I see. Instead of serialcount, you'll want to use machinecount (the index variable of the first loop).
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder Right, I see. Instead of serialcount, you'll want to use machinecount (the index variable of the first loop). Hey Acoder,
So like this? does the index need to be removed or put a different name behind index? - <cfloop from="1" to="#form['partscount' & machinecount]#" index="machineCount">
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
Yes, you should use a different name to avoid problems.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder Yes, you should use a different name to avoid problems. Hey Acoder,
I did this - <!---Inserts parts information into parts table.--->
-
<!---because it is a bit we don't use 'ticks' around defective for parts table--->
-
<cfloop from="1" to="#form['partscount' & machinecount]#" index="ps">
-
<cfquery name="parts" datasource="CustomerSupport">
-
exec usp_CS_Insertparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">,
-
'#Form.submission#'
-
</cfquery>
-
</cfloop>
but i am getting the following error
An error occurred while evaluating the expression:
hcpn = Form["hcpn_" & machineCount]
Error near line 60, column 8.
--------------------------------------------------------------------------------
The member "HCPN_2" in dimension 1 of object "Form" cannot be found. Please, modify the member name.
an the error comes from in the cfset area - <!---Inserts information into serial table.--->
-
<CFIF REQUEST_METHOD EQ "POST">
-
<CFSET machineListLen = listLen(Form.serialcount)>
-
<CFLOOP from="1" to="#machineListLen#" index="machineCount">
-
<CFSET serialnum = Form["serialnum_" & machineCount]>
-
<CFSET modelno = Form["modelno_" & machineCount]>
-
<CFSET producttype = Form["producttype_" & machineCount]>
-
<CFSET softhardware = Form["softhardware_" & machineCount]>
-
<CFSET resolution = Form["resolution_" & machineCount]>
-
<CFSET resdate = Form["resdate_" & machineCount]>
-
<CFSET resvertified = Form["resvertified_" & machineCount]>
-
<CFSET vertifidate = Form["vertifidate_" & machineCount]>
-
<CFSET deptvendor = Form["deptvendor_" & machinecount]>
-
<CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
-
<CFSET rma = Form["rma_" & machineCount]>
-
<CFSET thedescription = Form["thedescription_" & machineCount]>
-
<CFSET hcpn = Form["hcpn_" & machineCount]>
-
<CFSET partsreturn = Form["partsreturn_" & machineCount]>
-
<CFSET defective = Form["defective_" & machineCount]>
-
<!--- <CFSET followdate = Form["followdate_" & machineCount]>
-
<CFSET onsite = Form["onsite_" & machineCount]>
-
<CFSET numonsite = Form["numonsite_" & machineCount]>--->
-
-
<cfquery name="serial" datasource="CustomerSupport">
-
exec usp_CS_Insertserial
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#resdate#">,
-
<cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#vertifidate#">,
-
<cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">
-
</cfquery>
-
-
<!---Inserts information into notes_descr table.--->
-
<cfquery name="description" datasource="CustomerSupport">
-
exec usp_CS_Insertdescription
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.fk_addedBy#'
-
</cfquery>
-
-
-
<!---Inserts parts information into parts table.--->
-
<!---because it is a bit we don't use 'ticks' around defective for parts table--->
-
<cfloop from="1" to="#form['partscount' & machinecount]#" index="ps">
-
<cfquery name="parts" datasource="CustomerSupport">
-
exec usp_CS_Insertparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">,
-
'#Form.submission#'
-
</cfquery>
-
</cfloop>
-
</CFLOOP>
-
</CFIF>
-
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
The variables corresponding to the parts query should be in the second cfloop. Check what you've named the parts fields.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder The variables corresponding to the parts query should be in the second cfloop. Check what you've named the parts fields. Hey Acoder,
i checked the fields an there named correctly unless instead of hcpn it needs to be hcpn_
here is what i got in the javascript for it - "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' >" +
-
"<th class='sectiontitle' colspan='7'>Parts Information "+ count +" Serial Information "+serialno+"</th>" +
-
"<tr>" +
-
"<td class='indent' id='formfieldpadding'>HC P/N: <input type='text' name='hcpn_" + count + "' style='margin:0px'></td>" +
-
"<td class='red'>" +
-
"Parts been returned* " +
-
"<input type='checkbox' name='partsreturn_" + count +"' value='1'/>" +
-
"</td>" +
-
"<td>" +
-
"<td class='indent'>Defective<input type='checkbox' name='defective_" + count +"' value='1'/></td>" +
-
"</td>" +
-
"</tr>" +
-
"</table>" +
and here is what i have for the submitting - <cfloop from="1" to="#form['partscount' & machinecount]#" index="ps">
-
<CFSET hcpn = Form["hcpn_" & machineCount]>
-
<CFSET partsreturn = Form["partsreturn_" & machineCount]>
-
<CFSET defective = Form["defective_" & machineCount]>
-
<cfquery name="parts" datasource="CustomerSupport">
-
exec usp_CS_Insertparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">,
-
'#Form.submission#'
-
</cfquery>
-
</cfloop>
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
In that loop, for the parts query variables, you should replace machineCount with ps (the index variable).
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder In that loop, for the parts query variables, you should replace machineCount with ps (the index variable). Hey Acoder,
It worked, but didn't work. It inserted into the table but not how it needs to insert.
When it inserted instead of creating a separate record for each part. It made 2 records but put the information from both parts in both records
example
here is how it looks
record 1: hc_part no: test 1 p, test 2 p
record 2: hc_part no: test 1 p, test 2 p
an how it needs to look
record 1: hc_part no: test 1 p
record 2: hc_part no: test 2 p
do i need to add this line to the top of parts? - <CFIF REQUEST_METHOD EQ "POST">
here is what i have for parts - <cfloop from="1" to="#form['partscount' & machinecount]#" index="ps">
-
<CFSET hcpn = Form["hcpn_" & ps]>
-
<CFSET partsreturn = Form["partsreturn_" & ps]>
-
<CFSET defective = Form["defective_" & ps]>
-
<cfquery name="parts" datasource="CustomerSupport">
-
exec usp_CS_Insertparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">,
-
'#Form.submission#'
-
</cfquery>
-
</cfloop>
Thank you :),
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
Does this affect just hcpn or all three variables?
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder Does this affect just hcpn or all three variables? Hey Acoder,
It affects all 3 fields
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
Either check on the client-side (using, say, Firebug) what the generated source is when you have two parts, or turn debugging on and check what's passed through to Coldfusion. Check the names of the parts input fields.
You should turn debugging on anyway if you haven't already done so. On a development machine it should be turned on so you can get useful information about your application.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem
Hey Acoder,
With the debugging for coldfusion i don't have the ability to turn it on because its controlled by the main web developer. Basically the errors i get are what i get.
but i opened up firebug an i didn't see anything that stands out. Basically here is what i get when i have to parts though.this is looking at the html of it.
dynamic1input
part1name1
dynamic2input
part1name2
an i noticed in the database that it puts the hcpn field like this part 1,part 2
however for all the other fields it only puts one value in those.
But here is what i have in full - <!---Inserts information into serial table.--->
-
<CFIF REQUEST_METHOD EQ "POST">
-
<CFSET machineListLen = listLen(Form.serialcount)>
-
<CFLOOP from="1" to="#machineListLen#" index="machineCount">
-
<CFSET serialnum = Form["serialnum_" & machineCount]>
-
<CFSET modelno = Form["modelno_" & machineCount]>
-
<CFSET producttype = Form["producttype_" & machineCount]>
-
<CFSET softhardware = Form["softhardware_" & machineCount]>
-
<CFSET resolution = Form["resolution_" & machineCount]>
-
<CFSET resdate = Form["resdate_" & machineCount]>
-
<CFSET resvertified = Form["resvertified_" & machineCount]>
-
<CFSET vertifidate = Form["vertifidate_" & machineCount]>
-
<CFSET deptvendor = Form["deptvendor_" & machinecount]>
-
<CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
-
<CFSET rma = Form["rma_" & machineCount]>
-
<CFSET thedescription = Form["thedescription_" & machineCount]>
-
<!--- <CFSET followdate = Form["followdate_" & machineCount]>
-
<CFSET onsite = Form["onsite_" & machineCount]>
-
<CFSET numonsite = Form["numonsite_" & machineCount]>--->
-
-
<cfquery name="serial" datasource="CustomerSupport">
-
exec usp_CS_Insertserial
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#resdate#">,
-
<cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#vertifidate#">,
-
<cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">
-
</cfquery>
-
-
<!---Inserts information into notes_descr table.--->
-
<cfquery name="description" datasource="CustomerSupport">
-
exec usp_CS_Insertdescription
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.fk_addedBy#'
-
</cfquery>
-
-
-
<!---Inserts parts information into parts table.--->
-
<!---because it is a bit we don't use 'ticks' around defective for parts table--->
-
<cfloop from="1" to="#form['partscount' & machinecount]#" index="ps">
-
<CFSET hcpn = Form["hcpn_" & ps]>
-
<CFSET partsreturn = Form["partsreturn_" & ps]>
-
<CFSET defective = Form["defective_" & ps]>
-
<cfquery name="parts" datasource="CustomerSupport">
-
exec usp_CS_Insertparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">,
-
'#Form.submission#'
-
</cfquery>
-
</cfloop>
-
</CFLOOP>
-
</CFIF>
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
Check the three variables in Firebug by expanding one part (the +) and see the values.
Is there no chance you could ask the main web developer to switch it on for you. Surely it'd make things easier.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder Check the three variables in Firebug by expanding one part (the +) and see the values.
Is there no chance you could ask the main web developer to switch it on for you. Surely it'd make things easier. Hey Acoder,
Well with the main developer, i can never get a hold of him. We was suppose to go over something a week an a half ago an still haven't. But i did notice something looking for the 3 variables.
dynamic1input has this - <input id="partscount1" type="hidden" value="1" name="partscount1"/>
-
<input id="serialcount" type="hidden" value="1" name="serialcount"/>
dynamic2input - <input id="partscount2" type="hidden" value="1" name="partscount2"/>
-
<input id="serialcount" type="hidden" value="2" name="serialcount"/>
an when i looked under part1Name1 and part1Name2 all the fields had hcpn_1 partsreturn_1 and defective_1. I don't know if that means anything but thought i would point it out.
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
That will be the problem. All parts variables have the same name, so when passed to Coldfusion, it's passed as a list which is what's being added to the database.
What you'll need to do is make all parts fields unique. You can do that by adding the serial count to the name, e.g. by adding "_" + serialcount, then modifying the Coldfusion to get each unique parts field.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder That will be the problem. All parts variables have the same name, so when passed to Coldfusion, it's passed as a list which is what's being added to the database.
What you'll need to do is make all parts fields unique. You can do that by adding the serial count to the name, e.g. by adding "_" + serialcount, then modifying the Coldfusion to get each unique parts field. Hey Acoder,
I get what your saying, just not sure on the naming part. So would something like this work? - <input type='text' name='hcpn_" + count + "_"+serialcount"' style='margin:0px'>
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
Almost - you forgot the + after serialcount.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder Almost - you forgot the + after serialcount. Hey Acoder,
Does it need to be serialcount or serialno? because it says serialcount is undefined. here is what i have - "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' >" +
-
"<th class='sectiontitle' colspan='7'>Parts Information "+ count +" Serial Information "+serialno+"</th>" +
-
"<tr>" +
-
"<td class='indent' id='formfieldpadding'>HC P/N: " +
-
"<input type='text' name='hcpn_" + count + "_"+serialcount+"' style='margin:0px'></td>" +
-
"<td class='red'>" +
-
"Parts been returned* " +
-
"<input type='checkbox' name='partsreturn_" + count +"_"+serialcount+"' value='1'>" +
-
"</td>" +
-
"<td>" +
-
"<td class='indent'>Defective<input type='checkbox' name='defective_" + count +"_"+serialcount+"' value='1'>" +
-
"</td>" +
-
"</td>" +
-
"</tr>" +
-
"</table>";
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
Yes, then it must be serialno, not serialcount.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: Insert Multiple Parts Problem Quote:
Originally Posted by acoder Yes, then it must be serialno, not serialcount. Hey Acoder,
Ok then in my cfloop would it be like this? or do i need to get serialno in here as well? - <cfloop from="1" to="#form['partscount' & machinecount]#" index="ps">
-
<CFSET hcpn = Form["hcpn_" & ps & "_machinecount"]>
-
<CFSET partsreturn = Form["partsreturn_" & ps & "_machinecount"]>
-
<CFSET defective = Form["defective_" & ps & "_machinecount"]>
-
<cfquery name="parts" datasource="CustomerSupport">
-
exec usp_CS_Insertparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.ID#',
-
<cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">,
-
'#Form.submission#'
-
</cfquery>
-
</cfloop>
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Insert Multiple Parts Problem
If you're going to put machinecount in the string, then wrap it in #s or take it out of the string like ps.
|  | | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,449 network members.
|