Now this getparts query should be after the serial display and before the parts output and you would loop this query.
displaying previously entered multiple fields
Collapse
X
-
Originally posted by acoderNow this getparts query should be after the serial display and before the parts output and you would loop this query.
So would i just put a loop around the getparts query an then would it be like
<cfloop from="" to=""> or a different type of loop? an if it is this type of loop what would i put in from and to? but here is what i have
Code:<!---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,rma_data,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---> <!---dbtype="query"---> <cfquery name="getparts" dbtype="query" > SELECT * FROM dbo.tbl_CS_parts WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" cfsqltype="cf_sql_char" maxLength="20"> </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,defective,submission FROM dbo.tbl_CS_parts WHERE fk_ticketNo = #URL.pk_ticketID# </cfquery>
RachComment
-
The FROM clause of the getparts query should be using the "parts" query, not referring to the database/table names in the database.
It should also appear after the parts query. Looping would be the normal loop over a query as you're already doing.Comment
-
Originally posted by acoderThe FROM clause of the getparts query should be using the "parts" query, not referring to the database/table names in the database.
It should also appear after the parts query. Looping would be the normal loop over a query as you're already doing.
So would this be correct?
Code:<!---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,rma_data,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---> <!---dbtype="query"---> <cfquery name="getparts" dbtype="query" > SELECT * FROM parts WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" cfsqltype="cf_sql_char" maxLength="20"> </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,defective,submission FROM dbo.tbl_CS_parts WHERE fk_ticketNo = #URL.pk_ticketID# </cfquery>
RachComment
-
Originally posted by acoderThe parts query can remain where it is, but you need to move the getparts query to where the parts are displayed. Also the cfloop on line 196 (post #1) should now be over "getparts", not parts.
When i move the cfloop. Do i need to include the count that i had around the cfloop or just take it out?
Thank you,
RachComment
-
Originally posted by acoderYou don't need to move the loop. Just replace "parts" with "getparts".
When i go to view one i previously submitted i am getting the error
Error resolving parameter PKA_SERIALNO
ColdFusion was unable to determine the value of the parameter
here is what i have
Code:<!---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,rma_data,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,defective,submission FROM dbo.tbl_CS_parts WHERE fk_ticketNo = #URL.pk_ticketID# </cfquery> <!---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>
RachComment
-
Originally posted by acoderThat's because pka_serialNo hasn't been set yet. That query (getparts) needs to be moved to where the second inner cfloop is.
you saying something like this?
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"> <cfloop query="getparts"> <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> <!--- 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_#count#" >#rma_data#</textarea> </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('divIdName')">---> </td> </tr> </table> <cfset count1 = 0> <!---<cfif serial.recordcount is 0>---> <cfset count1 = count1 + 1> <!---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#" style="margin:0px" value="#hc_partNo#"></td> <td class="red"> Parts been returned* <input type="checkbox" name="partsreturn_#count1#" value="#part_returned#"<cfif #part_returned# eq "1">checked=yes</cfif>/> </td> <td> <td class="indent">Defective<input type="checkbox" name="defective_#count#1" value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/></td> </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('partIdName')"></a> </td> </td> </tr> </table> </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#> <cfset rma_data = #rma_data#> </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 = ""> <cfset rma_data = ""> <cfinclude template="serialdisplay.cfm"> </cfif> <!--- <cfset count = 0> <cfoutput query="parts"> <cfset count = count + 1> <div id="partscount#count#"> <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" name="serialcount" value="#count#"> <!--- 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#> <cfinclude template="partsdisplay.cfm"> </cfoutput> <cfif parts.recordcount is 0> <cfset hc_partNo = ""> <cfset part_returned = ""> <cfset defective = ""> <cfoutput><cfinclude template="partsdisplay.cfm"></cfoutput> </cfif> ---></div> <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
RachComment
-
Originally posted by acoderI'm not sure why you've moved it there (line 13). It needed to stay where it was (line 196/7), but just changed to what it is now ("getparts") .
Here is what i have in full
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> <!--- 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_#count#" >#rma_data#</textarea> </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('divIdName')">---> </td> </tr> </table> <cfset count1 = 0> <!---<cfif serial.recordcount is 0>---> <cfloop query="getparts"> <cfset count1 = count1 + 1> <!---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#" style="margin:0px" value="#hc_partNo#"></td> <td class="red"> Parts been returned* <input type="checkbox" name="partsreturn_#count1#" value="#part_returned#"<cfif #part_returned# eq "1">checked=yes</cfif>/> </td> <td> <td class="indent">Defective<input type="checkbox" name="defective_#count#1" value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/></td> </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('partIdName')"></a> </td> </td> </tr> </table> </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#> <cfset rma_data = #rma_data#> </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 = ""> <cfset rma_data = ""> <cfinclude template="serialdisplay.cfm"> </cfif> <!--- <cfset count = 0> <cfoutput query="parts"> <cfset count = count + 1> <div id="partscount#count#"> <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" name="serialcount" value="#count#"> <!--- 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#> <cfinclude template="partsdisplay.cfm"> </cfoutput> <cfif parts.recordcount is 0> <cfset hc_partNo = ""> <cfset part_returned = ""> <cfset defective = ""> <cfoutput><cfinclude template="partsdisplay.cfm"></cfoutput> </cfif> ---></div> <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
RachComment
-
Originally posted by acoderThe getparts query should be just before the loop where it's used.
That is working beautifully. The only thing i can not get working is adding parts and deleting parts. With the deleteing parts when we go an insert it we had deleting set to partIdName and i tried to change it from that to part#count1#Nam eserialno but that don't seem to work. An tried to change the add part from divIdName to dynamic#count#I nput. But cant seem to get it right. Here is what is in the html
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> <!--- 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_#count#" >#rma_data#</textarea> </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('divIdName')">---> </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> <!---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#" style="margin:0px" value="#hc_partNo#"></td> <td class="red"> Parts been returned* <input type="checkbox" name="partsreturn_#count1#" value="#part_returned#"<cfif #part_returned# eq "1">checked=yes</cfif>/> </td> <td> <td class="indent">Defective<input type="checkbox" name="defective_#count#1" value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/></td> </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('partIdName')"></a> </td> </td> </tr> </table> </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#> <cfset rma_data = #rma_data#> </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 = ""> <cfset rma_data = ""> <cfinclude template="serialdisplay.cfm"> </cfif> <!--- <cfset count = 0> <cfoutput query="parts"> <cfset count = count + 1> <div id="partscount#count#"> <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" name="serialcount" value="#count#"> <!--- 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#> <cfinclude template="partsdisplay.cfm"> </cfoutput> <cfif parts.recordcount is 0> <cfset hc_partNo = ""> <cfset part_returned = ""> <cfset defective = ""> <cfoutput><cfinclude template="partsdisplay.cfm"></cfoutput> </cfif> ---></div> <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
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; 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 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 + "'>" + "<option value='' selected>Make A Selection</option>" + "<cfoutput query='getDeptVendor'>" + "<option value='#pk_deptVendor#'>#pk_deptVendor#</option>" + " </cfoutput>" + "</select>" + "</td>" + "</tr>" + "</table>"; <!--- Adds Extra fields for RMA Data Only ---> newdiv.innerHTML = newdiv.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 + "'></textarea> " + "</td>" + "</tr>" + "</table>" + "<input type='hidden' name='"+partc+"' id='"+partc+"' value='0'>" + "<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 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 class='red'>" + "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>"; <!---"<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>"; ---> <!--- 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>
RachComment
-
For the add/delete functionality to work, you need to make sure the counts match up. So if there are three, the count has to be 3 and the divs IDs/field names all have to be correct. Check the add functions to see how the naming works and make sure the display from Coldfusion is the same.Comment
Comment