Almost - you forgot the + after serialcount.
Insert Multiple Parts Problem
Collapse
X
-
Originally posted by acoderAlmost - you forgot the + after serialcount.
Does it need to be serialcount or serialno? because it says serialcount is undefined. here is what i have
Code:"<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>";
RachComment
-
Originally posted by acoderYes, then it must be serialno, not serialcount.
Ok then in my cfloop would it be like this? or do i need to get serialno in here as well?
Code:<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>
RachComment
-
Originally posted by acoderIf you're going to put machinecount in the string, then wrap it in #s or take it out of the string like ps.
I think i might have to do it the way you aid with the ps because i got this
Error Diagnostic Information
An error occurred while evaluating the expression:
partsreturn = Form["partsretur n_" & ps & "_#machinecount #"]
Error near line 94, column 8.
The member "PARTSRETURN_1_ 2" in dimension 1 of object "Form" cannot be found. Please, modify the member name.
an this is what i have
Code:<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,
RachComment
-
No, what you have is correct, though the alternative would be:
Code:Form["partsreturn_" & ps & "_" & machinecount]
Comment
-
Originally posted by acoderNo, what you have is correct, though the alternative would be:
Code:Form["partsreturn_" & ps & "_" & machinecount]
Well checked the name for partsreturn an made sure they all match an they do. But i think i know what the problem is. Well when i been testing, for the part i add with the first serial i choose everything. But for the second serial and the first part for it i choose nothing for partsreturn and defective. An it says cant find the object so think its because i am leaving it blank. But thing is i have the following lines in there in case someone does leave it blank
Code:<cfparam name="Form.defective" default="0"> <cfparam name="Form.partsreturn" default="0">
Code:<CFSET partsreturn = Form["partsreturn_" & ps & "_#machinecount#"]>
Thank you,
RachComment
-
Originally posted by acoderWell, the cfparam doesn't account for the new names. You need to use two cfloops and cfparam all possible part fields. What you could do is put the cfparam just before the cfsets in the second loop.
i get the same error. i dont know if this help but it also says
The member "PARTSRETURN_1_ 2" in dimension 1 of object "Form" cannot be found. Please, modify the member name.
Code:<cfloop from="1" to="#form['partscount' & machinecount]#" index="ps"> <cfparam name="Form.defective" default="0"> <cfparam name="Form.partsreturn" default="0"> <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>
RachComment
-
Originally posted by acoderYou can't set only form.partsretur n and form.defective. You need to set the correct name similar to what you have in the cfset: form.partsretur n_#ps#_#machine count#
It worked!!! Thank you, Thank you!!! But i have another question, if i have questions about printing the in formation, like viewing what was previously entered for parts do i need to create another thread for that? because having a hard time viewing what was previously entered.
Thank you so much for all the help!!!!!!!!! :)
RachComment
-
Originally posted by bonneylakei have another question, if i have questions about printing the in formation, like viewing what was previously entered for parts do i need to create another thread for that? because having a hard time viewing what was previously entered.
Originally posted by bonneylakeThank you so much for all the help!!!!!!!!! :)Comment
-
Originally posted by acoderYes, you should create another thread for that problem.
You're very welcome! I'm glad it's now working.
i created another thread and here is the thread i started in case anyone is interested.
but thank you again for all the help :),
RachComment
Comment