In your code in #161, just add the ticket no. I can't recall now, but I think that it was passed via the URL.
displaying previously entered multiple fields
Collapse
X
-
Hey Acoder,Originally posted by acoderIn your code in #161, just add the ticket no. I can't recall now, but I think that it was passed via the URL.
Here is what i have in full. An when the user opens up a ticket an when a user goes to the second page it gets passed via URL. but when they finally submit it (like we are doing) it don't get passed by URL it just submits.
Thank you,Code:<cftransaction> <!---Inserts information into serial table.---> <cfquery name="deleteserialparts" datasource="CustomerSupport"> exec usp_CS_Deleteserialparts '#Form.pk_ticketID#' </cfquery> <CFIF REQUEST_METHOD EQ "POST"> <CFSET machineListLen = listLen(Form.serialcount)> <CFLOOP from="1" to="#machineListLen#" index="machineCount"> <cfloop> <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 thedescription = Form["thedescription_" & machineCount]> <!--- inserts information into the serial table---> <cfquery name="serialinsertupdate" datasource="CustomerSupport"> exec usp_CS_Updateserial <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">, "#Form.pk_ticketID#", <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"> </cfquery> <!---Inserts information into notes_descr table.---> <cfquery name="description" datasource="CustomerSupport"> exec usp_CS_Insertdescription <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">, '#Form.pk_ticketID#', <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 list="#form['part2count' & machinecount]#" index="ps"> <cfloop> <cfparam name="Form.defective_#ps#_#machinecount#" default="0"> <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0"> <CFSET hcpn = Form["hcpn_" & "#ps#" & "_#machinecount#"]> <CFSET partsreturn = Form["partsreturn_" & "#ps#" & "_#machinecount#"]> <CFSET defective = Form["defective_" & "#ps#" & "_#machinecount#"]> <CFSET rma = Form["rma_" & "#ps#" & "_#machineCount#"]> <cfquery name="parts" datasource="CustomerSupport"> exec usp_CS_Updateparts <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">, '#Form.pk_ticketID#', <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">, <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">, <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">, <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR"> </cfquery> </cfloop> </cfloop> </cfloop> </CFLOOP> </CFIF>
RachComment
-
Hey Acoder,Originally posted by acoderThat looks right. Did you test it?
I tested it, an it deleted, but it did not reinsert the information into the table. I had to delete the 2 extra cfloops i had in there cause it was causing trouble beyond that i still have the same thing.
Thank you,Code:<cftransaction> <!---Inserts information into serial table.---> <cfquery name="deleteserialparts" datasource="CustomerSupport"> exec usp_CS_Deleteserialparts '#Form.pk_ticketID#' </cfquery> <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 thedescription = Form["thedescription_" & machineCount]> <!--- inserts information into the serial table---> <cfquery name="serialinsertupdate" datasource="CustomerSupport"> exec usp_CS_Updateserial <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">, "#Form.pk_ticketID#", <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"> </cfquery> <!---Inserts information into notes_descr table.---> <cfquery name="description" datasource="CustomerSupport"> exec usp_CS_Insertdescription <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">, '#Form.pk_ticketID#', <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 list="#form['part2count' & machinecount]#" index="ps"> <cfparam name="Form.defective_#ps#_#machinecount#" default="0"> <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0"> <CFSET hcpn = Form["hcpn_" & "#ps#" & "_#machinecount#"]> <CFSET partsreturn = Form["partsreturn_" & "#ps#" & "_#machinecount#"]> <CFSET defective = Form["defective_" & "#ps#" & "_#machinecount#"]> <CFSET rma = Form["rma_" & "#ps#" & "_#machineCount#"]> <cfquery name="parts" datasource="CustomerSupport"> exec usp_CS_Updateparts <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">, '#Form.pk_ticketID#', <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">, <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">, <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">, <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR"> </cfquery> </cfloop> </CFLOOP> </CFIF>
RachComment
-
Hey Acoder,Originally posted by acoderYeah, you had some extra cfloop tags.
Have you checked what's being passed from the client-side? Does it flag up any errors?
I figured it out, i needed to change the exec from updating to insert, so now its inserting it. But sadly i am still having the same trouble i had before. After i made the change an went to edit its still showing duplicate entries although in the table itself it only shows the serials i insert once. An like before its only putting duplicates of previously submitted serials. The new one i inserted (to try the change out) did not insert another one only the previous serial i had before.
But i think i know where the problem is. I started taking out things an well i been thinking the whole time it was the javascript doing it, an so i took out all the javascript at the top that allows users to add serials and parts. an well i went and made changes to one serial and resubmitted it an went back to edit it an it only showed that one serial! so i think the javascript is causing it, but i have no clue where it is causing it. Here is what i have for the javascript on this page.
Thank you,Code:<!---Allows us to add serial information multiple times ---> <script type="text/javascript"> <!---Allows us to add multiple fields ---> function addInput(divName){ var dynamic = document.getElementById('dynamicInput'); var thevalue = document.getElementById('theValue'); var count = (document.getElementById('theValue').value -1)+ 2; thevalue.value = count; var newdiv = document.createElement('div'); var getparts = document.createElement('div'); var divIdName = 'dynamic'+count+'Input'; var partc = 'partscount'+count; var part2c = 'part2count'+count; newdiv.setAttribute('id',divIdName); <!--- Adds Extra fields for Model No, Product Type, and Type of Hardware Failure ---> newdiv.innerHTML = "<table class='zpExpandedTable' id='modeltable'>" + "<th class='sectiontitletick' colspan='7'>Serial Information "+ count +" </th>" + "<tr>" + "<td id='paddingformultitop'>Model No: </td>" + "</td>" + "<td>" + "<select name='modelno_" + count + "' >" + "<option value=''>Make A Selection</option>" + "<cfoutput query='models'>" + "<option value='#model#'>#model#</option>" + "</cfoutput>" + "</select>" + "</td>" + "<td>" + " Product Type:" + "</td>" + "<td>" + "<select name='producttype_" + count + "'>" + "<option value='' selected>No Choice</option>" + "<cfoutput query='getProdType'>" + "<option value='#pk_productType#'>#pk_productType#</option>" + "</cfoutput>" + "</select>" + "</td>" + "<td class='red'>" + " Type Of Hardware Failure*:" + "</td>" + "<td>" + "<select id='hardwarefailure' name='hardwarefailure_" + count + "'>" + "<option value='' selected>Make A Selection</option>" + "<cfoutput query='getHardwareFail'>" + "<option value='#pk_hardwareFailure#'>#pk_hardwareFailure#</option>" + "</cfoutput>" + "</select>" + "</td>" + "</tr>" + "<table>"; <!--- Adds Extra fields for Serial Number and Software/Hardware ---> newdiv.innerHTML = newdiv.innerHTML + "<table class='zpExpandedTable' id='modeltable'>" + "<tr>" + "<td id='paddingformultitop'>" + "Serial Number: " + "<input type='text' name='serialnum_" + count + "'>" + " Software/Hardware: " + "<select name='softhardware_" + count + "'>" + "<option value='' selected>No Choice</option>" + "<cfoutput query='getSoftHard'>" + "<option value='#pk_softwareHardware#'>#pk_softwareHardware#</option>" + "</cfoutput>" + "</select>" + "</td>" + "</tr>" + "</table>"; <!--- Adds Extra fields for Description ---> newdiv.innerHTML = newdiv.innerHTML + "<table class='zpExpandedTable' id='resoltable' cellpadding='3' cellspacing='0'>" + "<tr>" + "<td id='paddingformutli'>" + "Description: " + "</td>" + "<td class='descriptionmoveinmulti'>" + "( You may enter up to 1000 characters. )"+ "<br>" + "<textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name='thedescription_" + count + "'></textarea>" + "</td>" + "</tr>" + "</table>"; <!--- Adds Extra fields for Resolution ---> newdiv.innerHTML = newdiv.innerHTML + "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" + "<tr>" + "<td id='paddingformutli'>" + "Resolution: " + "</td>" + "<td class='resolutionmoveinmulti'>" + "( You may enter up to 1500 characters. )"+ "<br>" + "<textarea maxlength='1500' onkeyup='return resolutionmaxlength(this)' onkeydown='return resolutionmaxlength(this)' rows='4' cols='60' name='resolution_" + count + "'></textarea>" + "</td>" + "</tr>" + "</table>"; <!--- Adds Extra fields for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by ---> newdiv.innerHTML = newdiv.innerHTML + "<table class='zpExpandedTable' id='resoldatetab' cellpadding='1' cellspacing='0'>" + "<tr>" + "<td id='paddingformultitop'>" + "Resolution Date: (MM/DD/YYYY) " + "</td>" + "<td>" + "<input type='text' name='resdate_" + count + "' value='' > " + " Current Date: " + "<input type='checkbox' name='currentdateresol_" + count + "' onClick=resdate_" + count + ".value=fill_date()>" + "</td>" + "<td>" + "Resolution Verified as effective by: " + "</td>" + "<td>" + "<select name='resvertified_" + count + "'>" + "<option value='' selected>Make A Selection</option>" + "<cfoutput query='gettech'><option value='#fname# #lname#'>#fname# #lname#</option></cfoutput>" + "</select>" + "</td>" + "</tr>" + "</table>"; <!--- Adds Extra fields for Vertification Date, Current Date (for vertification date) and resolution vertified as effective by ---> newdiv.innerHTML = newdiv.innerHTML + "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" + "<tr>" + "<td id='paddingformultitop'>" + "Verification Date: (MM/DD/YYYY) " + "</td>" + "<td class='vertificationmoveinmulti'>" + "<input type='text' name='vertifidate_" + count + "'> " + " Current Date: " + "<input type='checkbox' name='currentdatevert_" + count + "' onClick=vertifidate_" + count + ".value=fill_date()>" + "</td>" + "</tr>" + "</table>"; <!--- Adds Extra fields for Dept/Vendor Responsibility ---> newdiv.innerHTML = newdiv.innerHTML + "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" + "<tr>" + "<td class='red' id='paddingformultitop'>" + "Dept/Vendor Responsibility*: " + "<select name='deptvendor_" + count + "' id='deptvendor'>" + "<option value='' selected>Make A Selection</option>" + "<cfoutput query='getDeptVendor'>" + "<option value='#pk_deptVendor#'>#pk_deptVendor#</option>" + " </cfoutput>" + "</select>" + "</td>" + "</tr>" + "</table>" + "<input type='hidden' name='"+partc+"' id='"+partc+"' value='0'>" + "<input type='hidden' name='"+part2c+"' id='"+part2c+"' value=''>" + "<input type='hidden' name='serialcount' id='serialcount' value='" + count + "'>"; <!--- Adds Delete to every ticket ---> newdiv.innerHTML = newdiv.innerHTML + "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" + "<tr>" + "<td>" + "<input type='button' class='removeticket' value='Remove Serial ""+ count +""' onclick=\"removeElement(\'"+divIdName+"\')\"></a>" + "</td>" + "</tr>" + "<tr>" + "<td>" + "<input type='button' class='addticket' value='Add Parts' onclick=\"addpartInput(\'"+divIdName+"\')\">" + "</td>" + "</tr>" + "</table>"; document.getElementById(divName).appendChild(newdiv); } <!---Allows us to remove multiple fields ---> function removeElement(divNum) { var d = document.getElementById('dynamicInput'); var olddiv = document.getElementById(divNum); d.removeChild(olddiv); } </script> <!---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); <!---('partsInput')---> <!---this works if only want to add a part under the serial you are working with, but if you have serial information 1 and serial information 2 an want to add information to serial information 1 you cant because parts always appear under the last serial information added if you click add parts---> var getparts = document.getElementById('div'); <!---var avalue = document.getElementById('aValue');---> var serialno = partName.replace("dynamic","").replace("Input",""); var avalue = document.getElementById("partscount"+serialno); <!---var count = (document.getElementById('avalue').value -1)+ 2;---> var count = parseInt(avalue.value) + 1; avalue.value = count; var partslist = document.getElementById("part2count"+serialno); partslist.value += count + ","; var partdiv = document.createElement('div'); <!---var partIdName = 'part'+count+'Name';---> var partIdName = 'part' + count + 'Name' + serialno; <!---'parts'+count+'Input'---> 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 + "_"+serialno+"' style='margin:0px'></td>" + "<td>" + "Parts been returned* " + "<input type='checkbox' name='partsreturn_" + count + "_"+serialno+"' value='1'>" + "</td>" + "<td>" + "<td class='indent'>Defective<input type='checkbox' name='defective_" + count +"_"+serialno+"' value='1'>" + "</td>" + "</td>" + "</tr>" + "</table>"; <!--- Adds Extra fields for RMA Data Only ---> partdiv.innerHTML = partdiv.innerHTML + "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" + "<tr>" + "<td id='paddingformultitop'>" + "RMA Data Only: " + "</td>" + "<td class='rmanmoveinmulti'>" + "( You may enter up to 1000 characters. )"+ "<br/>" + "<textarea maxlength='1000' onkeyup='return rmamaxlength(this)' onkeydown='return rmamaxlength(this)' rows='4' cols='60' name='rma_" + count + "_"+serialno+"'></textarea> " + "</td>" + "</tr>" + "</table>"; <!--- 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+"',"+serialno+","+count+")\"></a>" + "</td>" + "</td>" + "</tr>" + "</table>"; document.getElementById(partName).appendChild(partdiv); } <!---Allows us to remove multiple fields---> function removetheElement(divNum, serialno, partnum) { <!---var d = document.getElementById('partsInput');---> var partslist = document.getElementById("part2count"+serialno); partslist.value = partslist.value.replace(partnum+',',""); var olddiv = document.getElementById(divNum); olddiv.parentNode.removeChild(olddiv); } </script>
RachComment
-
It won't be the JavaScript which is causing it because the JavaScript only adds when you call it unless you are calling addInput when the page loads.
At least the inserting is now working, so it's just the displaying which is causing problems. Look at the Coldfusion code which generates the HTMLComment
-
Hey Acoder,Originally posted by acoderIt won't be the JavaScript which is causing it because the JavaScript only adds when you call it unless you are calling addInput when the page loads.
At least the inserting is now working, so it's just the displaying which is causing problems. Look at the Coldfusion code which generates the HTML
The only way it can call addInput would be something like for example body onload="dynamic Input" correct? i did have that at one point but not anymore so i don't think i am calling it but it only happens when i go back an look at that page. Like it is not inserting duplicate records in the database (never was) it only redisplays duplicates when i get to the cticketpage2edi t.cfm page where it shows the previously submitted records for serial and parts.
An i am confused on the coldfusion code which generates the html? are you talking about the coldfusion querys where it shows the results? or are you talking about the html code that appears inbetween the divs?
Thank you,
RachComment
-
I mean the code which generates the HTML displaying the serials and parts.
When you say go back, do you mean pressing the back button or do you mean clicking a link to go back to another page? Can you show the relevant able displaying code from cticketpage2edi t.cfm.Comment
-
Hey Acoder,Originally posted by acoderI mean the code which generates the HTML displaying the serials and parts.
When you say go back, do you mean pressing the back button or do you mean clicking a link to go back to another page? Can you show the relevant able displaying code from cticketpage2edi t.cfm.
I mean when i click the link to go to another page. However, the thing is it will only show the duplicate if i click the final submit. If i am on cticketpage2edi t and close it out an go to relook at it, it doesn't insert the duplicate. Just when i click that final submit button. An like i said when i took out all the javascript at the top, it didn't show a duplicate when i clicked on that final submit button and viewed the information again. but here is what i have inbetween the div's that display the previously entered information
Thank you,Code:<!--- Ticket Information This display the ticket Information---> <!---<input type="hidden" value="0" id="theValue" />---> <div id="dynamicInput"> <!--- All Ticket Information Appears Here---> <!--- Shows what was previously entered for Model No, Product Type, and Type of Hardware Failure ---> <cfset count = 0> <!---<cfif serial.recordcount is 0>---> <cfoutput query="serial"> <cfset model_no = #model_no#> <cfset product_type = #product_type#> <cfset type_hardware_failure = #type_hardware_failure#> <cfset software_hardware = #software_hardware#> <cfset resolution_verified_by = #resolution_verified_by#> <cfset dept_responsibility = #dept_responsibility#> <cfset count = count + 1> <div id="dynamic#count#Input"> <table class="zpExpandedTable" id="modeltable"> <th class="sectiontitletick" colspan="7"> Serial Information #count# </th> <tr> <td id="paddingformultitop">Model No: </td> </td> <td> <select name="modelno_#count#"> <option value="">Make A Selection</option> <cfloop query="models"> <option value="#model#"<cfif #model# is #model_no#>selected</cfif>>#model#</option> </cfloop> </select> </td> <td> Product Type: </td> <td> <select name="producttype_#count#"> <option value="" selected>No Choice</option> <cfloop query="getProdType"> <option value="#pk_productType#"<cfif #pk_productType# is #product_type#>selected</cfif>>#pk_productType#</option> </cfloop> </select> </td> <td class="red"> Type Of Hardware Failure*: </td> <td> <select name="hardwarefailure_#count#"> <option value="" selected>Make A Selection</option> <cfloop query="getHardwareFail"> <option value="#pk_hardwareFailure#"<cfif #pk_hardwareFailure# is #type_hardware_failure#>selected</cfif>>#pk_hardwareFailure#</option> </cfloop> </select> </td> </tr> <table> <!--- Shows what was previously entered for Serial Number and Software/Hardware ---> <table class="zpExpandedTable" id="modeltable"> <tr> <td id="paddingformultitop"> Serial Number: <input type="text" name="serialnum_#count#" value="#pka_serialNo#"> Software/Hardware: <select name="softhardware_#count#"> <option value="" selected>No Choice</option> <cfloop query="getSoftHard"> <option value="#pk_softwareHardware#"<cfif #pk_softwareHardware# is #software_hardware#>selected</cfif>>#pk_softwareHardware#</option> </cfloop> </select> </td> </tr> </table> <!--- Shows what was previously entered for Description ---> <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0"> <tr> <td id="paddingformutli"> Description: </td> <td class="descriptionmoveinmulti"> #description# ( You may enter up to 1000 characters. ) <br> <textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name="thedescription_#count#"></textarea> </td> </tr> </table> <!---Shows what was previously entered for Resolution ---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <tr> <td id="paddingformutli"> Resolution: </td> <td class="resolutionmoveinmulti"> ( You may enter up to 1500 characters. ) <br> <textarea maxlength="1500" onkeyup="return resolutionismaxlength(this)" onkeydown="return resolutionismaxlength(this)" rows="4" cols="60" name="resolution_#count#">#resolution#</textarea> </td> </tr> </table> <!--- Shows what was previously entered for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by ---> <table class="zpExpandedTable" id="resoldatetab" cellpadding="1" cellspacing="0"> <tr> <td id="paddingformultitop"> Resolution Date: (MM/DD/YYYY) </td> <td> <input type="text" name="resdate_#count#" value="#DateFormat(resolution_date,'mm/dd/yyyy')#"> Current Date: <input type="checkbox" name="currentdateresol_#count#" onClick="resdate_#count#.value=fill_date()"> </td> <td> Resolution Verified as effective by: </td> <td> <select name="resvertified_#count#"> <option value="" selected>Make A Selection</option> <cfloop query="gettech"> <option value="#fname# #lname#"<cfif "#fname# #lname#" is #resolution_verified_by#> selected</cfif>>#fname# #lname#</option> </cfloop> </select> </td> </tr> </table> <!--- Shows what was previously entered for Vertification Date, Current Date (for vertification date) ---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <tr> <td id="paddingformultitop"> Verification Date: (MM/DD/YYYY) </td> <td class="vertificationmoveinmulti"> <input type="text" name="vertifidate_#count#" value="#DateFormat(verification_date,'mm/dd/yyyy')#"> Current Date: <input type="checkbox" name="currentdatevert_#count#" onClick="vertifidate_#count#.value=fill_date()"> </td> </tr> </table> <!--- Shows what was previously entered for Dept/Vendor Responsibility ---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <tr> <td class="red" id="paddingformultitop"> Dept/Vendor Responsibility*: <select name="deptvendor_#count#"> <option value="" selected>Make A Selection</option> <cfloop query="getDeptVendor"> <option value="#pk_deptVendor#"<cfif #pk_deptVendor# is #dept_responsibility#>selected</cfif>>#pk_deptVendor#</option> </cfloop> </select> </td> </tr> </table> <input type="hidden" name="serialcount" id="serialcount" value="#count#"> <!--- Adds Delete to every ticket ---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <tr> <td> <input type="button" class="removeticket" value="Remove Serial #count#" onclick="removeElement('dynamic#count#Input')"> </td> </tr> <tr> <td> <input type="button" class="addticket" value="Add Parts" onclick= "addpartInput('dynamic#count#Input')"> </td> </tr> </table> <!---Shows what was previously entered into parts table---> <!---dbtype="query"---> <cfquery name="getparts" dbtype="query" > SELECT * FROM parts WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" cfsqltype="cf_sql_char" maxLength="20"> </cfquery> <cfset count1 = 0> <!---<cfif serial.recordcount is 0>---> <cfloop query="getparts"> <cfset count1 = count1 + 1> <div id="part#count1#Name#count#"> <cfset partliststr = ""> <cfloop from="1" to="#count1#" index="pl"> <cfset partliststr = partliststr & #pl# & ","> </cfloop> <input type="hidden" name="part2count#count#" id="part2count#count#" value="#partliststr#"> <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#"> <!---THIS IS THE PARTS SECTION---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <th class="sectiontitle" colspan="7">Parts Information #count1# Serial Information #count#</th> <tr> <td class='indent' id='formfieldpadding'>HC P/N: <input type='text' name="hcpn_#count1#_#count#" style="margin:0px" value="#hc_partNo#"></td> <td> Parts been returned* <input type="checkbox" name="partsreturn_#count1#_#count#" value="#part_returned#"<cfif #part_returned# eq "1">checked=yes</cfif>/> </td> <td> <td class="indent">Defective<input type="checkbox" name="defective_#count1#_#count#" value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/></td> </td> </tr> </table> <!---<input type="hidden" name="partscount#count#" id="partscount#count#" value="#count#">---> <!--- Shows what was previously entered for RMA Data Only ---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <tr> <td id="paddingformultitop"> RMA Data Only: </td> <td class="rmanmoveinmulti"> ( You may enter up to 1000 characters. ) <br/> <textarea maxlength="1000" onkeyup="return rmaismaxlength(this)" onkeydown="return rmaismaxlength(this)" rows="4" cols="60" name="rma_#count1#_#count#" >#rma_number#</textarea> </td> </tr> </table> <!--- Adds Delete to every ticket ---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <tr> <td> <input type="button" class="removeticket" value="Remove Parts #count1#" onclick="removetheElement('part#count1#Name#count#',#count#,#count#)"></a> </td> </td> </tr> </table> </div> </cfloop> </div> </cfoutput> <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" /> <!---If have any blanks in serial table it will make field appear---> <cfoutput query="serial"> <cfset model_no = #model_no#> <cfset product_type = #product_type#> <cfset type_hardware_failure = #type_hardware_failure#> <cfset pka_serialNo = #pka_serialNo#> <cfset software_hardware = #software_hardware#> <cfset description = #description#> <cfset resolution = #resolution#> <cfset resolution_date = #resolution_date#> <cfset resolution_verified_by = #resolution_verified_by#> <cfset verification_date = #verification_date#> <cfset dept_responsibility = #dept_responsibility#> </cfoutput> <cfif serial.recordcount is 0> <cfset model_no = ""> <cfset product_type = ""> <cfset type_hardware_failure = ""> <cfset pka_serialNo = ""> <cfset software_hardware = ""> <cfset description = ""> <cfset resolution = ""> <cfset resolution_date = ""> <cfset resolution_verified_by = ""> <cfset verification_date = ""> <cfset dept_responsibility = ""> <cfinclude template="serialdisplay.cfm"> </cfif> <!---Parts Information, display parts if have or don't have a value---> <cfoutput query="parts"> <cfset hc_partNo = #hc_partNo#> <cfset part_returned = #part_returned#> <cfset defective = #defective#> <cfset rma_number = #rma_number#> <cfinclude template="partsdisplay.cfm"> </cfoutput> <cfif parts.recordcount is 0> <cfset hc_partNo = ""> <cfset part_returned = ""> <cfset defective = ""> <cfset rma_number = ""> <cfinclude template="partsdisplay.cfm"> </cfif> </div> <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
RachComment
-
I'm not sure what could be the exact cause of this strange behaviour, but I notice that you have serialdisplay.c fm and partsdisplay.cf m included at the bottom. I can't recall exactly (from a previous thread), but I remember those files containing the display for serials/parts which would mean a duplicate display. However, this should mean that it occurs every time and not only in certain circumstances. Can you remind me of the contents of serialdisplay.c fm.Comment
-
Hey Acoder,
What serialdisplay.c fm and partsdisplay.cf m do is when a field or fields are not entered what it does is display those fields because before if a field was not enetered it would not display the field at all.This would happen if a serial or parts section was not filled out an then it happened only to certain fields, especially text input fields. But i know if this could be the problem considering i have commented out the lines that have anything to do with those 2 files an the problem still happened.. But Here is what i have in both files
serialdisplay.c fm
partsdisplay.cf mCode:<!---IF HAVE ANY BLANKS IN ANY FIELDS THIS MAKES IT SO THE FIELD WILL SHOW UP---> <cfif serial.recordcount is 0> <cfset count = 0> <cfset count = count + 1> <cfoutput> <div id="dynamic#count#Input"> <table class="zpExpandedTable" id="modeltable"> <th class="sectiontitletick" colspan="7"> Serial Information #count# </th> <tr> <td id="paddingformultitop">Model No: </td> </td> <td> <select name="modelno_#count#"> <option value="">Make A Selection</option> <cfloop query="models"> <option value="#model#">#model#</option> </cfloop> </select> </td> <td> Product Type: </td> <td> <select name="producttype_#count#"> <option value="" selected>No Choice</option> <cfloop query="getProdType"> <option value="#pk_productType#">#pk_productType#</option> </cfloop> </select> </td> <td class="red'"> Type Of Hardware Failure*: </td> <td> <select name="hardwarefailure_#count#"> <option value="" selected>Make A Selection</option> <cfloop query="getHardwareFail"> <option value="#pk_hardwareFailure#">#pk_hardwareFailure#</option> </cfloop> </select> </td> </tr> <table> <!--- Shows what was previously entered for Serial Number and Software/Hardware ---> <table class="zpExpandedTable" id="modeltable"> <tr> <td id="paddingformultitop"> Serial Number: <input type="text" name="serialnum_#count#" value=""> Software/Hardware: <select name="softhardware_#count#"> <option value="" selected>No Choice</option> <cfloop query="getSoftHard"> <option value="#pk_softwareHardware#">#pk_softwareHardware#</option> </cfloop> </select> </td> </tr> </table> <!--- Shows what was previously entered for Description ---> <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0"> <tr> <td id="paddingformutli"> Description: </td> <td class="descriptionmoveinmulti"> ( You may enter up to 1000 characters. ) <br> <textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name="thedescription_#count#"></textarea> </td> </tr> </table> <!---Shows what was previously entered for Resolution ---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <tr> <td id="paddingformutli"> Resolution: </td> <td class="resolutionmoveinmulti"> ( You may enter up to 1500 characters. ) <br> <textarea maxlength='1500' onkeyup='return resolutionmaxlength(this)' onkeydown='return resolutionmaxlength(this)' rows='4' cols='60' name="resolution_#count#"></textarea> </td> </tr> </table> <!--- Shows what was previously entered for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by ---> <table class="zpExpandedTable" id="resoldatetab" cellpadding="1" cellspacing="0"> <tr> <td id="paddingformultitop"> Resolution Date: (MM/DD/YYYY) </td> <td> <input type="text" name="resdate_#count#" value=""> Current Date: <input type="checkbox" name="currentdateresol_#count#" onClick="resdate_#count#.value=fill_date()"> </td> <td> Resolution Verified as effective by: </td> <td> <select name="resvertified_#count#"> <option value="" selected>Make A Selection</option> <cfloop query="gettech"> <option value="#fname# #lname#">#fname# #lname#</option> </cfloop> </select> </td> </tr> </table> <!--- Shows what was previously entered for Vertification Date, Current Date (for vertification date) ---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <tr> <td id="paddingformultitop"> Verification Date: (MM/DD/YYYY) </td> <td class="vertificationmoveinmulti"> <input type="text" name="vertifidate_#count#" value=""> Current Date: <input type="checkbox" name="currentdatevert_#count#" onClick="vertifidate_#count#.value=fill_date()"> </td> </tr> </table> <!--- Shows what was previously entered for Dept/Vendor Responsibility ---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <tr> <td class="red" id="paddingformultitop"> Dept/Vendor Responsibility*: <select name="deptvendor_#count#"> <option value="" selected>Make A Selection</option> <cfloop query="getDeptVendor"> <option value="#pk_deptVendor#">#pk_deptVendor#</option> </cfloop> </select> </td> </tr> </table> <input type="hidden" name="serialcount" value="#count#"> <!--- Adds Delete to every ticket ---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <tr> <td> <input type="button" class="removeticket" value="Remove Serial #count#" onclick="removeElement('dynamic#count#Input')"> </td> </tr> <tr> <td> <input type="button" class="addticket" value="Add Parts" onclick= "addpartInput('dynamic#count#Input')"> </td> </tr> </table> </div> </cfoutput> <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" /> </cfif>
Thank you,Code:<!---IF HAVE ANY BLANKS IN ANY FIELDS THIS MAKES IT SO THE FIELD WILL SHOW UP---> <cfif parts.recordcount is 0> <cfset count1 = 0> <cfoutput> <cfset count1 = count1 + 1> <div id="part#count1#Name#count#"> <!---THIS IS THE PARTS SECTION---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <th class="sectiontitle" colspan="7">Parts Information #count1# Serial Information #count#</th> <tr> <td class='indent' id='formfieldpadding'>HC P/N: <input type='text' name="hcpn_#count1#_#count#" style="margin:0px" value=""></td> <td> Parts been returned* <input type="checkbox" name="partsreturn_#count1#_#count#" value=""<cfif #part_returned# eq "1">checked=yes</cfif>/> </td> <td> <td class="indent">Defective<input type="checkbox" name="defective_#count1#_#count#" value=""<cfif #defective# eq "1">checked=yes</cfif>/></td> </td> </tr> </table> <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#"> <!--- Shows what was previously entered for RMA Data Only ---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <tr> <td id="paddingformultitop"> RMA Data Only: </td> <td class="rmanmoveinmulti"> ( You may enter up to 1000 characters. ) <br/> <textarea maxlength="1000" onkeyup="return rmaismaxlength(this)" onkeydown="return rmaismaxlength(this)" rows="4" cols="60" name="rma_#count1#_#count#" ></textarea> </td> </tr> </table> <!--- Adds Delete to every ticket ---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <tr> <td> <input type="button" class="removeticket" value="Remove Parts #count1#" onclick="removetheElement('part#count1#Name#count#')"></a> </td> </td> </tr> </table> </div> </cfoutput> <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" /> </cfif>
RachComment
-
Hey Acoder,
After trying a few more tests. I think parts might be the problem.
what i did was submitted and entry where there was only a serial (no parts). When i went to look back at it i saw nothing for parts (i commented out partsdisplay.cf m).An i opened up firebug an i saw nothing associated with parts in there. However, when i click to add another serial and view it in firebug, it included these 2 lines.
the thing with it is i have not added a part to this new serial yet. An i never added a part to the old serial but yet its counting it like i did add a part. Also, i even tried just submitted the previously fill in serial with no extra serial or any parts an i got the errorCode:<input id="partscount2" type="hidden" value="0" name="partscount2"/> <input id="part2count2" type="hidden" value="" name="part2count2"/> <input id="serialcount" type="hidden" value="2" name="serialcount"/>
i think parts could possible be adding something extra to it. The only way it can be adding extra to it. Is in the javascript under the serial function of the javascript there is these 3 linesCode:An error occurred while evaluating the expression: "#form['part2count' & machinecount]#" Error near line 91, column 20. The member "PART2COUNT1" in dimension 1 of object "form" cannot be found. Please, modify the member name.
the only thing i can think of to prevent it is to move the 2 part lines to the parts function of the javascript. However, i am not sure how to do this without running into problems.Code:"<input type='hidden' name='"+partc+"' id='"+partc+"' value='0'>" + "<input type='hidden' name='"+part2c+"' id='"+part2c+"' value=''>" + "<input type='hidden' name='serialcount' id='serialcount' value='" + count + "'>";
Thank you,
RachComment
-
You're right about the serial/parts displays.
Now, can you explain this again in more detail? Is the submit button on the cticketpage2edi t page? When you say relook, do you mean this edit page or the page before? Also, by "insert duplicate", you mean display a duplicate entry because it's not physically creating a duplicate in the database, right?Originally posted by bonneylakeHowever, the thing is it will only show the duplicate if i click the final submit. If i am on cticketpage2edi t and close it out an go to relook at it, it doesn't insert the duplicate. Just when i click that final submit button. An like i said when i took out all the javascript at the top, it didn't show a duplicate when i clicked on that final submit button and viewed the information again.
How many pages are there in total in the whole process of creating/updating serials/parts and what's the purpose of each page?Comment
-
Hey Acoder,Originally posted by acoderYou're right about the serial/parts displays.
Now, can you explain this again in more detail? Is the submit button on the cticketpage2edi t page? When you say relook, do you mean this edit page or the page before? Also, by "insert duplicate", you mean display a duplicate entry because it's not physically creating a duplicate in the database, right?
How many pages are there in total in the whole process of creating/updating serials/parts and what's the purpose of each page?
Alrighty here we go. Alrighty yes the submit button (final submit) button is on cticketpage2edi t.cfm. When i say relook i mean once i make changes, submit the changes an then reopen cticketpage2edi t to see the changes i made is when i notice it. It does not insert duplicate entrys into the table it only displays duplicate entrys when i go back an look at cticketpage2edi t.
Alrighty there are 2 pages. Cticketpage1edi t.cfm displays the general information and contact information. When i click submit on cticketpage1edi t.cfm it takes me to cticketpage2edi t.cfm where it redisplays the general information and contact information and it also allows the user to add/edit serials and parts (cticketpage1ed it has nothing involving serial or parts). Because the form is long we split it into 2 pages to make it easier on the person filling out the information. On the second page is where the user edit/enters serial information and parts information an once the user is done then the user resubmits all the information from general information and contact information an also submits all the changes for serial and parts.
i don't know if this would help. But this is what i have in full on the cticketpage2edi t.cfm page.
querys that display the information
the javascript for serial and partsCode:<cfquery name="models" datasource="systems"> Select distinct Model From models </cfquery> <!---Shows what was previously entered into serial and description table---> <cfquery name="serial" datasource="CustomerSupport"> SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware, resolution,resolution_date,verification_date,type_hardware_failure, dept_responsibility,resolution_verified_by,fk_serialNo,fk_ticketNo,description FROM dbo.tbl_CS_serial LEFT JOIN dbo.tbl_CS_notes_descr ON dbo.tbl_CS_serial.pkb_fk_ticketNo=dbo.tbl_CS_notes_descr.fk_ticketNo and dbo.tbl_CS_serial.pka_serialNo=dbo.tbl_CS_notes_descr.fk_serialNo WHERE pkb_fk_ticketNo = #URL.pk_ticketID# and fk_ticketNo = #URL.pk_ticketID# ORDER BY pkb_fk_ticketNo </cfquery> <!---Shows what was previously entered into parts table---> <cfquery name="parts" datasource="CustomerSupport"> SELECT pk_partID,fk_serialNo,fk_ticketNo,hc_partNo,ltrim(rtrim(part_returned)) as part_returned,rma_number,defective FROM dbo.tbl_CS_parts WHERE fk_ticketNo = #URL.pk_ticketID# </cfquery>
Code:<!---Allows us to add serial information multiple times ---> <script type="text/javascript"> <!---Allows us to add multiple fields ---> function addInput(divName){ var dynamic = document.getElementById('dynamicInput'); var thevalue = document.getElementById('theValue'); var count = (document.getElementById('theValue').value -1)+ 2; thevalue.value = count; var newdiv = document.createElement('div'); var getparts = document.createElement('div'); var divIdName = 'dynamic'+count+'Input'; var partc = 'partscount'+count; var part2c = 'part2count'+count; newdiv.setAttribute('id',divIdName); <!--- Adds Extra fields for Model No, Product Type, and Type of Hardware Failure ---> newdiv.innerHTML = "<table class='zpExpandedTable' id='modeltable'>" + "<th class='sectiontitletick' colspan='7'>Serial Information "+ count +" </th>" + "<tr>" + "<td id='paddingformultitop'>Model No: </td>" + "</td>" + "<td>" + "<select name='modelno_" + count + "' >" + "<option value=''>Make A Selection</option>" + "<cfoutput query='models'>" + "<option value='#model#'>#model#</option>" + "</cfoutput>" + "</select>" + "</td>" + "<td>" + " Product Type:" + "</td>" + "<td>" + "<select name='producttype_" + count + "'>" + "<option value='' selected>No Choice</option>" + "<cfoutput query='getProdType'>" + "<option value='#pk_productType#'>#pk_productType#</option>" + "</cfoutput>" + "</select>" + "</td>" + "<td class='red'>" + " Type Of Hardware Failure*:" + "</td>" + "<td>" + "<select id='hardwarefailure' name='hardwarefailure_" + count + "'>" + "<option value='' selected>Make A Selection</option>" + "<cfoutput query='getHardwareFail'>" + "<option value='#pk_hardwareFailure#'>#pk_hardwareFailure#</option>" + "</cfoutput>" + "</select>" + "</td>" + "</tr>" + "<table>"; <!--- Adds Extra fields for Serial Number and Software/Hardware ---> newdiv.innerHTML = newdiv.innerHTML + "<table class='zpExpandedTable' id='modeltable'>" + "<tr>" + "<td id='paddingformultitop'>" + "Serial Number: " + "<input type='text' name='serialnum_" + count + "'>" + " Software/Hardware: " + "<select name='softhardware_" + count + "'>" + "<option value='' selected>No Choice</option>" + "<cfoutput query='getSoftHard'>" + "<option value='#pk_softwareHardware#'>#pk_softwareHardware#</option>" + "</cfoutput>" + "</select>" + "</td>" + "</tr>" + "</table>"; <!--- Adds Extra fields for Description ---> newdiv.innerHTML = newdiv.innerHTML + "<table class='zpExpandedTable' id='resoltable' cellpadding='3' cellspacing='0'>" + "<tr>" + "<td id='paddingformutli'>" + "Description: " + "</td>" + "<td class='descriptionmoveinmulti'>" + "( You may enter up to 1000 characters. )"+ "<br>" + "<textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name='thedescription_" + count + "'></textarea>" + "</td>" + "</tr>" + "</table>"; <!--- Adds Extra fields for Resolution ---> newdiv.innerHTML = newdiv.innerHTML + "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" + "<tr>" + "<td id='paddingformutli'>" + "Resolution: " + "</td>" + "<td class='resolutionmoveinmulti'>" + "( You may enter up to 1500 characters. )"+ "<br>" + "<textarea maxlength='1500' onkeyup='return resolutionmaxlength(this)' onkeydown='return resolutionmaxlength(this)' rows='4' cols='60' name='resolution_" + count + "'></textarea>" + "</td>" + "</tr>" + "</table>"; <!--- Adds Extra fields for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by ---> newdiv.innerHTML = newdiv.innerHTML + "<table class='zpExpandedTable' id='resoldatetab' cellpadding='1' cellspacing='0'>" + "<tr>" + "<td id='paddingformultitop'>" + "Resolution Date: (MM/DD/YYYY) " + "</td>" + "<td>" + "<input type='text' name='resdate_" + count + "' value='' > " + " Current Date: " + "<input type='checkbox' name='currentdateresol_" + count + "' onClick=resdate_" + count + ".value=fill_date()>" + "</td>" + "<td>" + "Resolution Verified as effective by: " + "</td>" + "<td>" + "<select name='resvertified_" + count + "'>" + "<option value='' selected>Make A Selection</option>" + "<cfoutput query='gettech'><option value='#fname# #lname#'>#fname# #lname#</option></cfoutput>" + "</select>" + "</td>" + "</tr>" + "</table>"; <!--- Adds Extra fields for Vertification Date, Current Date (for vertification date) and resolution vertified as effective by ---> newdiv.innerHTML = newdiv.innerHTML + "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" + "<tr>" + "<td id='paddingformultitop'>" + "Verification Date: (MM/DD/YYYY) " + "</td>" + "<td class='vertificationmoveinmulti'>" + "<input type='text' name='vertifidate_" + count + "'> " + " Current Date: " + "<input type='checkbox' name='currentdatevert_" + count + "' onClick=vertifidate_" + count + ".value=fill_date()>" + "</td>" + "</tr>" + "</table>"; <!--- Adds Extra fields for Dept/Vendor Responsibility ---> newdiv.innerHTML = newdiv.innerHTML + "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" + "<tr>" + "<td class='red' id='paddingformultitop'>" + "Dept/Vendor Responsibility*: " + "<select name='deptvendor_" + count + "' id='deptvendor'>" + "<option value='' selected>Make A Selection</option>" + "<cfoutput query='getDeptVendor'>" + "<option value='#pk_deptVendor#'>#pk_deptVendor#</option>" + " </cfoutput>" + "</select>" + "</td>" + "</tr>" + "</table>" + "<input type='hidden' name='"+partc+"' id='"+partc+"' value='0'>" + "<input type='hidden' name='"+part2c+"' id='"+part2c+"' value=''>" + "<input type='hidden' name='serialcount' id='serialcount' value='" + count + "'>"; <!--- Adds Delete to every ticket ---> newdiv.innerHTML = newdiv.innerHTML + "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" + "<tr>" + "<td>" + "<input type='button' class='removeticket' value='Remove Serial ""+ count +""' onclick=\"removeElement(\'"+divIdName+"\')\"></a>" + "</td>" + "</tr>" + "<tr>" + "<td>" + "<input type='button' class='addticket' value='Add Parts' onclick=\"addpartInput(\'"+divIdName+"\')\">" + "</td>" + "</tr>" + "</table>"; document.getElementById(divName).appendChild(newdiv); } <!---Allows us to remove multiple fields ---> function removeElement(divNum) { var d = document.getElementById('dynamicInput'); var olddiv = document.getElementById(divNum); d.removeChild(olddiv); } </script> <!---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); <!---('partsInput')---> <!---this works if only want to add a part under the serial you are working with, but if you have serial information 1 and serial information 2 an want to add information to serial information 1 you cant because parts always appear under the last serial information added if you click add parts---> var getparts = document.getElementById('div'); <!---var avalue = document.getElementById('aValue');---> var serialno = partName.replace("dynamic","").replace("Input",""); var avalue = document.getElementById("partscount"+serialno); <!---var count = (document.getElementById('avalue').value -1)+ 2;---> var count = parseInt(avalue.value) + 1; avalue.value = count; var partslist = document.getElementById("part2count"+serialno); partslist.value += count + ","; var partdiv = document.createElement('div'); <!---var partIdName = 'part'+count+'Name';---> var partIdName = 'part' + count + 'Name' + serialno; <!---'parts'+count+'Input'---> 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 + "_"+serialno+"' style='margin:0px'></td>" + "<td>" + "Parts been returned* " + "<input type='checkbox' name='partsreturn_" + count + "_"+serialno+"' value='1'>" + "</td>" + "<td>" + "<td class='indent'>Defective<input type='checkbox' name='defective_" + count +"_"+serialno+"' value='1'>" + "</td>" + "</td>" + "</tr>" + "</table>"; <!--- Adds Extra fields for RMA Data Only ---> partdiv.innerHTML = partdiv.innerHTML + "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" + "<tr>" + "<td id='paddingformultitop'>" + "RMA Data Only: " + "</td>" + "<td class='rmanmoveinmulti'>" + "( You may enter up to 1000 characters. )"+ "<br/>" + "<textarea maxlength='1000' onkeyup='return rmamaxlength(this)' onkeydown='return rmamaxlength(this)' rows='4' cols='60' name='rma_" + count + "_"+serialno+"'></textarea> " + "</td>" + "</tr>" + "</table>"; <!--- 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+"',"+serialno+","+count+")\"></a>" + "</td>" + "</td>" + "</tr>" + "</table>"; document.getElementById(partName).appendChild(partdiv); } <!---Allows us to remove multiple fields---> function removetheElement(divNum, serialno, partnum) { <!---var d = document.getElementById('partsInput');---> var partslist = document.getElementById("part2count"+serialno); partslist.value = partslist.value.replace(partnum+',',""); var olddiv = document.getElementById(divNum); olddiv.parentNode.removeChild(olddiv); } </script>
the html for serial and parts
Thank you,Code:<form action="userformedit.cfm" id="userForm" name="userForm" method="POST" enctype="multipart/form-data" onclick="multipleSelectOnSubmit();"> <!--- Ticket Information This display the ticket Information---> <!---<input type="hidden" value="0" id="theValue" />---> <div id="dynamicInput"> <!--- All Ticket Information Appears Here---> <cfset count = 0> <!---<cfif serial.recordcount is 0>---> <cfoutput query="serial"> <cfset model_no = #model_no#> <cfset product_type = #product_type#> <cfset type_hardware_failure = #type_hardware_failure#> <cfset software_hardware = #software_hardware#> <cfset resolution_verified_by = #resolution_verified_by#> <cfset dept_responsibility = #dept_responsibility#> <cfset count = count + 1> <!--- Shows what was previously entered for Model No, Product Type, and Type of Hardware Failure ---> <div id="dynamic#count#Input"> <table class="zpExpandedTable" id="modeltable"> <th class="sectiontitletick" colspan="7"> Serial Information #count# </th> <tr> <td id="paddingformultitop">Model No: </td> </td> <td> <select name="modelno_#count#"> <option value="">Make A Selection</option> <cfloop query="models"> <option value="#model#"<cfif #model# is #model_no#>selected</cfif>>#model#</option> </cfloop> </select> </td> <td> Product Type: </td> <td> <select name="producttype_#count#"> <option value="" selected>No Choice</option> <cfloop query="getProdType"> <option value="#pk_productType#"<cfif #pk_productType# is #product_type#>selected</cfif>>#pk_productType#</option> </cfloop> </select> </td> <td class="red"> Type Of Hardware Failure*: </td> <td> <select name="hardwarefailure_#count#"> <option value="" selected>Make A Selection</option> <cfloop query="getHardwareFail"> <option value="#pk_hardwareFailure#"<cfif #pk_hardwareFailure# is #type_hardware_failure#>selected</cfif>>#pk_hardwareFailure#</option> </cfloop> </select> </td> </tr> <table> <!--- Shows what was previously entered for Serial Number and Software/Hardware ---> <table class="zpExpandedTable" id="modeltable"> <tr> <td id="paddingformultitop"> Serial Number: <input type="text" name="serialnum_#count#" value="#pka_serialNo#"> Software/Hardware: <select name="softhardware_#count#"> <option value="" selected>No Choice</option> <cfloop query="getSoftHard"> <option value="#pk_softwareHardware#"<cfif #pk_softwareHardware# is #software_hardware#>selected</cfif>>#pk_softwareHardware#</option> </cfloop> </select> </td> </tr> </table> <!--- Shows what was previously entered for Description ---> <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0"> <tr> <td id="paddingformutli"> Description: </td> <td class="descriptionmoveinmulti"> #description# ( You may enter up to 1000 characters. ) <br> <textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name="thedescription_#count#"></textarea> </td> </tr> </table> <!---Shows what was previously entered for Resolution ---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <tr> <td id="paddingformutli"> Resolution: </td> <td class="resolutionmoveinmulti"> ( You may enter up to 1500 characters. ) <br> <textarea maxlength="1500" onkeyup="return resolutionismaxlength(this)" onkeydown="return resolutionismaxlength(this)" rows="4" cols="60" name="resolution_#count#">#resolution#</textarea> </td> </tr> </table> <!--- Shows what was previously entered for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by ---> <table class="zpExpandedTable" id="resoldatetab" cellpadding="1" cellspacing="0"> <tr> <td id="paddingformultitop"> Resolution Date: (MM/DD/YYYY) </td> <td> <input type="text" name="resdate_#count#" value="#DateFormat(resolution_date,'mm/dd/yyyy')#"> Current Date: <input type="checkbox" name="currentdateresol_#count#" onClick="resdate_#count#.value=fill_date()"> </td> <td> Resolution Verified as effective by: </td> <td> <select name="resvertified_#count#"> <option value="" selected>Make A Selection</option> <cfloop query="gettech"> <option value="#fname# #lname#"<cfif "#fname# #lname#" is #resolution_verified_by#> selected</cfif>>#fname# #lname#</option> </cfloop> </select> </td> </tr> </table> <!--- Shows what was previously entered for Vertification Date, Current Date (for vertification date) ---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <tr> <td id="paddingformultitop"> Verification Date: (MM/DD/YYYY) </td> <td class="vertificationmoveinmulti"> <input type="text" name="vertifidate_#count#" value="#DateFormat(verification_date,'mm/dd/yyyy')#"> Current Date: <input type="checkbox" name="currentdatevert_#count#" onClick="vertifidate_#count#.value=fill_date()"> </td> </tr> </table> <!--- Shows what was previously entered for Dept/Vendor Responsibility ---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <tr> <td class="red" id="paddingformultitop"> Dept/Vendor Responsibility*: <select name="deptvendor_#count#"> <option value="" selected>Make A Selection</option> <cfloop query="getDeptVendor"> <option value="#pk_deptVendor#"<cfif #pk_deptVendor# is #dept_responsibility#>selected</cfif>>#pk_deptVendor#</option> </cfloop> </select> </td> </tr> </table> <input type="hidden" name="serialcount" id="serialcount" value="#count#"> <!--- Adds Delete to every ticket ---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <tr> <td> <input type="button" class="removeticket" value="Remove Serial #count#" onclick="removeElement('dynamic#count#Input')"> </td> </tr> <tr> <td> <input type="button" class="addticket" value="Add Parts" onclick= "addpartInput('dynamic#count#Input')"> </td> </tr> </table> <!---Shows what was previously entered into parts table---> <!---dbtype="query"---> <cfquery name="getparts" dbtype="query" > SELECT * FROM parts WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" cfsqltype="cf_sql_char" maxLength="20"> </cfquery> <cfset count1 = 0> <!---<cfif serial.recordcount is 0>---> <cfloop query="getparts"> <cfset count1 = count1 + 1> <div id="part#count1#Name#count#"> <cfset partliststr = ""> <cfloop from="1" to="#count1#" index="pl"> <cfset partliststr = partliststr & #pl# & ","> </cfloop> <input type="hidden" name="part2count#count#" id="part2count#count#" value="#partliststr#"> <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#"> <!---THIS IS THE PARTS SECTION---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <th class="sectiontitle" colspan="7">Parts Information #count1# Serial Information #count#</th> <tr> <td class='indent' id='formfieldpadding'>HC P/N: <input type='text' name="hcpn_#count1#_#count#" style="margin:0px" value="#hc_partNo#"></td> <td> Parts been returned* <input type="checkbox" name="partsreturn_#count1#_#count#" value="#part_returned#"<cfif #part_returned# eq "1">checked=yes</cfif>/> </td> <td> <td class="indent">Defective<input type="checkbox" name="defective_#count1#_#count#" value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/></td> </td> </tr> </table> <!---<input type="hidden" name="partscount#count#" id="partscount#count#" value="#count#">---> <!--- Shows what was previously entered for RMA Data Only ---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <tr> <td id="paddingformultitop"> RMA Data Only: </td> <td class="rmanmoveinmulti"> ( You may enter up to 1000 characters. ) <br/> <textarea maxlength="1000" onkeyup="return rmaismaxlength(this)" onkeydown="return rmaismaxlength(this)" rows="4" cols="60" name="rma_#count1#_#count#" >#rma_number#</textarea> </td> </tr> </table> <!--- Adds Delete to every ticket ---> <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0"> <tr> <td> <input type="button" class="removeticket" value="Remove Parts #count1#" onclick="removetheElement('part#count1#Name#count#',#count#,#count#)"></a> </td> </td> </tr> </table> </div> </cfloop> </div> </cfoutput> <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" /> <!---If have any blanks in serial table it will make field appear---> <cfoutput query="serial"> <cfset model_no = #model_no#> <cfset product_type = #product_type#> <cfset type_hardware_failure = #type_hardware_failure#> <cfset pka_serialNo = #pka_serialNo#> <cfset software_hardware = #software_hardware#> <cfset description = #description#> <cfset resolution = #resolution#> <cfset resolution_date = #resolution_date#> <cfset resolution_verified_by = #resolution_verified_by#> <cfset verification_date = #verification_date#> <cfset dept_responsibility = #dept_responsibility#> </cfoutput> <cfif serial.recordcount is 0> <cfset model_no = ""> <cfset product_type = ""> <cfset type_hardware_failure = ""> <cfset pka_serialNo = ""> <cfset software_hardware = ""> <cfset description = ""> <cfset resolution = ""> <cfset resolution_date = ""> <cfset resolution_verified_by = ""> <cfset verification_date = ""> <cfset dept_responsibility = ""> <cfinclude template="serialdisplay.cfm"> </cfif> <!---Parts Information, display parts if have or don't have a value---> <!---<cfoutput query="parts"> <cfset hc_partNo = #hc_partNo#> <cfset part_returned = #part_returned#> <cfset defective = #defective#> <cfset rma_number = #rma_number#> <cfinclude template="partsdisplay.cfm"> </cfoutput> <cfif parts.recordcount is 0> <cfset hc_partNo = ""> <cfset part_returned = ""> <cfset defective = ""> <cfset rma_number = ""> <cfinclude template="partsdisplay.cfm"> </cfif>---> </div> <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" > <!--- Submit ---> <table> <tr> <td> <input type="submit" class="officalsubmit" value="submit" name="submit" onClick="return validate_form();"> </td> </tr> </table> </p> </form>
RachComment
Comment