What you can do is add a hidden field for the part ID in the display page, so when submitted, the parts number/ID is submitted with each part.
displaying previously entered multiple fields
Collapse
X
-
Originally posted by acoderWhat you can do is add a hidden field for the part ID in the display page, so when submitted, the parts number/ID is submitted with each part.
In the cticketpage2edi t.cfm (before submit page) i added the hidden field as such
Code:<cfoutput query="parts"> <input type="hidden" name="pk_partID" id="pk_partID" value="#pk_partID#" /> </cfoutput>
Code:<CFIF REQUEST_METHOD EQ "POST"> <!---counts how many serials are there---> <cfquery name="countserials" datasource="CustomerSupport"> SELECT pka_serialNo from dbo.tbl_CS_serial where pkb_fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#"> </cfquery> <cfset currSerialNo = 1> <!--- the array gets serials that have been inserted and updated to avoid deleteing the ones that need to be inserted or updated---> <cfset serialcheck = ArrayNew(1)> <!--- first loop inserts/update serials---> <CFLOOP list="#form.serialcount#" index="machineCount"> added for parts <cfquery name="countparts" datasource="CustomerSupport"> SELECT pk_partID from dbo.tbl_CS_parts where fk_serialNo=<cfqueryparam value="#serialnum#"> and fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#"> </cfquery> added for parts <cfset partcheck = ArrayNew(1)> <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]> <!---the array checks to see what serials are there---> <CFSET ArrayAppend(serialcheck, "#Form["serialnum_" & machineCount]#")> <!--- inserts information into the serial table---> <cfquery name="serialinsertupdate" datasource="CustomerSupport"> exec usp_CS_Updateinsertserial <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---> <cfparam name="form.partscount#machinecount#" default=""> <cfloop list="#form['partscount' & machinecount]#" index="ps"> <cfparam name="Form.hcpn_#ps#_#machinecount#" default=""> <cfparam name="Form.defective_#ps#_#machinecount#" default="0"> <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0"> <cfparam name="Form.rma_#ps#_#machinecount#" default=""> <CFSET pk_partID = Form["pk_partID_" & "#ps#" & "_#machinecount#"]> <CFSET hcpn = Form["hcpn_" & "#ps#" & "_#machinecount#"]> <CFSET partsreturn = Form["partsreturn_" & "#ps#" & "_#machinecount#"]> <CFSET defective = Form["defective_" & "#ps#" & "_#machinecount#"]> <CFSET rma = Form["rma_" & "#ps#" & "_#machineCount#"]> added for parts <CFSET ArrayAppend(partcheck, "#Form["pk_partID_" & "#ps#" & "_#machinecount#"]#")> <cfif hcpn neq ""> <cfquery name="parts" datasource="CustomerSupport"> exec usp_CS_Updateinsertparts <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="#rma#" CFSQLType = "CF_SQL_VARCHAR">, <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT"> </cfquery> <cfelse> </cfif> </cfloop> added for parts <cfset partList = ArrayToList(partcheck, ",")> <cfloop query="countparts"> <cfset pk_partID= #pk_partID#> <cfif not listFind(partList,pk_partID)> <cfquery name="deleteparts" datasource="CustomerSupport"> exec usp_CS_Deleteparts <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">, '#Form.pk_ticketID#' </cfquery> </cfif> </cfloop> </CFLOOP> <cfset serialList = ArrayToList(serialcheck, ",")> <!---when inserting/updating for serial's table is done delete serials not being updated/inserted or was deleted on purpose---> <cfloop query="countserials"> <CFSET serialnum = #pka_serialNo#> <!---<cfif ListFind(serialList,form.serialnum)>---> <!---for the serials numbers not found in the serialList it will delete those serials ---> <cfif not listFind(serialList,serialnum)> <cfquery name="deleteserialparts" datasource="CustomerSupport"> exec usp_CS_Deleteserialparts <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">, '#Form.pk_ticketID#' </cfquery> </cfif> </cfloop> </CFIF>
i got the error.Error resolving parameter SERIALNUM
ColdFusion was unable to determine the value of the parameter.
it said it had trouble with this line
Code:<cfquery name="countparts" datasource="CustomerSupport"> SELECT pk_partID from dbo.tbl_CS_parts where fk_serialNo=<cfqueryparam value="#serialnum#"> and fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
RachComment
-
That error is because serialnum hasn't been defined at that point, so you need to move the query lower down to after the serialnum variable has been set.
What you've added as a hidden field isn't enough. You need to add a unique field name for each part like serials, e.g. partid_1_1 (where 1 and 1 would be the part and serial numbers) and you don't need to use a separate cfoutput for it.Comment
-
Hey Acoder,
Well i added the hidden field into the parts section of the div like so
Code:<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> <cfloop query="getparts"> <cfset count1 = count1 + 1> <div id="part#count1#Name#count#"> <!---THIS IS THE PARTS SECTION---> <input type="hidden" name="pk_partID_#count1#_#count#" id="pk_partID" value="#pk_partID#" />
Code:<CFIF REQUEST_METHOD EQ "POST"> <!---counts how many serials are there---> <cfquery name="countserials" datasource="CustomerSupport"> SELECT pka_serialNo from dbo.tbl_CS_serial where pkb_fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#"> </cfquery> <cfset currSerialNo = 1> <!--- the array gets serials that have been inserted and updated to avoid deleteing the ones that need to be inserted or updated---> <cfset serialcheck = ArrayNew(1)> <!--- first loop inserts/update serials---> <CFLOOP list="#form.serialcount#" 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]> <!---the array checks to see what serials are there---> <CFSET ArrayAppend(serialcheck, "#Form["serialnum_" & machineCount]#")> added for parts <cfquery name="countparts" datasource="CustomerSupport"> SELECT pk_partID from dbo.tbl_CS_parts where fk_serialNo=<cfqueryparam value="#serialnum#"> and fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#"> </cfquery> added for parts <cfset partcheck = ArrayNew(1)> <!--- inserts information into the serial table---> <cfquery name="serialinsertupdate" datasource="CustomerSupport"> exec usp_CS_Updateinsertserial <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---> <cfparam name="form.partscount#machinecount#" default=""> <cfloop list="#form['partscount' & machinecount]#" index="ps"> <cfparam name="Form.hcpn_#ps#_#machinecount#" default=""> <cfparam name="Form.defective_#ps#_#machinecount#" default="0"> <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0"> <cfparam name="Form.rma_#ps#_#machinecount#" default=""> <CFSET pk_partID = Form["pk_partID_" & "#ps#" & "_#machinecount#"]> <CFSET hcpn = Form["hcpn_" & "#ps#" & "_#machinecount#"]> <CFSET partsreturn = Form["partsreturn_" & "#ps#" & "_#machinecount#"]> <CFSET defective = Form["defective_" & "#ps#" & "_#machinecount#"]> <CFSET rma = Form["rma_" & "#ps#" & "_#machineCount#"]> added for parts <CFSET ArrayAppend(partcheck, "#Form["pk_partID_" & "#ps#" & "_#machinecount#"]#")> <cfif hcpn neq ""> <cfquery name="parts" datasource="CustomerSupport"> exec usp_CS_Updateinsertparts <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="#rma#" CFSQLType = "CF_SQL_VARCHAR">, <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT"> </cfquery> <cfelse> </cfif> </cfloop> added for parts <cfset partList = ArrayToList(partcheck, ",")> <cfloop query="countparts"> <cfset pk_partID= #pk_partID#> <cfif not listFind(partList,pk_partID)> <cfquery name="deleteparts" datasource="CustomerSupport"> exec usp_CS_Deleteparts <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">, '#Form.pk_ticketID#' </cfquery> </cfif> </cfloop> </CFLOOP> <cfset serialList = ArrayToList(serialcheck, ",")> <!---when inserting/updating for serial's table is done delete serials not being updated/inserted or was deleted on purpose---> <cfloop query="countserials"> <CFSET serialnum = #pka_serialNo#> <!---<cfif ListFind(serialList,form.serialnum)>---> <!---for the serials numbers not found in the serialList it will delete those serials ---> <cfif not listFind(serialList,serialnum)> <cfquery name="deleteserialparts" datasource="CustomerSupport"> exec usp_CS_Deleteserialparts <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">, '#Form.pk_ticketID#' </cfquery> </cfif> </cfloop> </CFIF>
RachComment
-
Hey Acoder,
I got it! YAY, THANK YOU THANK YOU!!!. I got one more question which i think should be an easy one. But anyway i was thinking about it on the way to work. An well when we choose a serial to delete each serial will have one or more descriptions associated with it so i was thinking that the descriptions associated with the serial should be deleted as well (if they choose that particular serial to delete). So i was wondering could i do the same thing i did for serial and parts for description as well?
Thank you :),
RachComment
-
Hey Acoder,
Only question i got left is where would i put the delete description amongst everything?
Code:<CFIF REQUEST_METHOD EQ "POST"> <!---counts how many serials are there---> <cfquery name="countserials" datasource="CustomerSupport"> SELECT pka_serialNo from dbo.tbl_CS_serial where pkb_fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#"> </cfquery> <cfset currSerialNo = 1> <!--- the array gets serials that have been inserted and updated to avoid deleteing the ones that need to be inserted or updated---> <cfset serialcheck = ArrayNew(1)> <!--- first loop inserts/update serials---> <CFLOOP list="#form.serialcount#" 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]> <!---the array checks to see what serials are there---> <CFSET ArrayAppend(serialcheck, "#Form["serialnum_" & machineCount]#")> added for parts <cfquery name="countparts" datasource="CustomerSupport"> SELECT pk_partID from dbo.tbl_CS_parts where fk_serialNo=<cfqueryparam value="#serialnum#"> and fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#"> </cfquery> <!--- inserts information into the serial table---> <cfquery name="serialinsertupdate" datasource="CustomerSupport"> exec usp_CS_Updateinsertserial <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---> <cfparam name="form.partscount#machinecount#" default=""> <cfloop list="#form['partscount' & machinecount]#" index="ps"> <cfparam name="Form.pkpartID_#ps#_#machinecount#" default=""> <cfparam name="Form.hcpn_#ps#_#machinecount#" default=""> <cfparam name="Form.defective_#ps#_#machinecount#" default="0"> <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0"> <cfparam name="Form.rma_#ps#_#machinecount#" default=""> <CFSET pkpartID = Form["pkpartID_" & "#ps#" & "_#machinecount#"]> <CFSET hcpn = Form["hcpn_" & "#ps#" & "_#machinecount#"]> <CFSET partsreturn = Form["partsreturn_" & "#ps#" & "_#machinecount#"]> <CFSET defective = Form["defective_" & "#ps#" & "_#machinecount#"]> <CFSET rma = Form["rma_" & "#ps#" & "_#machineCount#"]> added for parts <CFSET ArrayAppend(partcheck, "#Form["pkpartID_" & "#ps#" & "_#machinecount#"]#")> <cfif hcpn neq ""> <cfquery name="parts" datasource="CustomerSupport"> exec usp_CS_Updateinsertparts <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="#rma#" CFSQLType = "CF_SQL_VARCHAR">, <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT"> </cfquery> <cfelse> </cfif> </cfloop> added for parts <cfset partList = ArrayToList(partcheck, ",")> <cfloop query="countparts"> <cfset pk_partID= #pk_partID#> <cfif not listFind(partList,pk_partID)> <cfquery name="deleteparts" datasource="CustomerSupport"> exec usp_CS_Deleteparts <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">, '#Form.pk_ticketID#' </cfquery> </cfif> </cfloop> </CFLOOP> <cfset serialList = ArrayToList(serialcheck, ",")> <!---when inserting/updating for serial's table is done delete serials not being updated/inserted or was deleted on purpose---> <cfloop query="countserials"> <CFSET serialnum = #pka_serialNo#> <!---<cfif ListFind(serialList,form.serialnum)>---> <!---for the serials numbers not found in the serialList it will delete those serials ---> <cfif not listFind(serialList,serialnum)> <cfquery name="deleteserialparts" datasource="CustomerSupport"> exec usp_CS_Deleteserialparts <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">, '#Form.pk_ticketID#' </cfquery> </cfif> </cfloop> </CFIF>
RachComment
-
Originally posted by acoderNo, I meant a delete cascade in your foreign key constraint in SQL Server.
I already created the stored procedure for the delete which is
Code:set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go -- ============================================= -- Author: <Author,,Name> -- Create date: <Create Date,,> -- Description: <Description,,> -- ============================================= ALTER PROCEDURE [dbo].[usp_CS_Deletenotesdescription] -- Add the parameters for the stored procedure here (@fk_serialNo nvarchar(100), @fk_ticketNo nvarchar(100)) as delete from dbo.tbl_CS_notes_descr where (fk_serialNo = @fk_serialNo and fk_ticketNo = @fk_ticketNo)
Thank you,
RachComment
-
I see. In that case, you could call it in Coldfusion, though if you want, you could still just use a delete cascade. For an idea of where it would go, if you recall from the thread in the SQL Server forum, when you create a foreign key constraint, if you specify ON DELETE CASCADE, the description would automatically get deleted when you delete the parent table (which would be serial). It saves out on defining and calling a separate stored procedure.
Anyway, if you still want to use this delete proc. then call it in the delete serial loop just after the "deleteserialpa rts" query.Comment
-
Hey Acoder,
Well i guess i need to do things your way. Because when i tried to delete for some reason it deleted everything that was written for the description field but it didn't delete the record.But how would i go about creating the delete cascade?
I also have another question. I wanted to add back in the blank fields (if they didn't fill out a serial/part) an well for some reason if i go back an look it will say serial 1 like its suppose to. But when i click add when i add a serial it will also say the new serial i added was 1.An also i am unable to add parts on the first serial (that was not filled out) for some reason. here is what i have on my cticketpage2edi t.cfm page
<!---If have any blanks in serial table it will make field appear--->
Code:<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#> <cfloop query="getnotes"> <cfset description = #description#></cfloop> <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 = ""> <cfif getnotes.recordcount is 0> <cfset description = ""></cfif> <cfset resolution = ""> <cfset resolution_date = ""> <cfset resolution_verified_by = ""> <cfset verification_date = ""> <cfset dept_responsibility = ""> <cfinclude template="serialdisplay.cfm"> </cfif>
Code:<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>
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
-
Originally posted by bonneylakeWell i guess i need to do things your way. Because when i tried to delete for some reason it deleted everything that was written for the description field but it didn't delete the record.But how would i go about creating the delete cascade?Comment
-
Hey Acoder,
Let me make sure i understand.Basi cally i need to do open a new query an do the following
Code:alter table dbo.tbl_CS_notes_descr add constraint thefkserial FOREIGN KEY (fk_serialNo,fk_ticketNo) REFERENCES dbo.tbl_CS_serial (pka_serialNo,pkb_fk_ticketNo) on delete cascade
Code:set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go -- ============================================= -- Author: <Author,,Name> -- Create date: <Create Date,,> -- Description: <Description,,> -- ============================================= CREATE PROCEDURE [dbo].[usp_CS_Deletenotesdescription] -- Add the parameters for the stored procedure here (@fk_serialNo nvarchar(50), @fk_ticketNo numeric(18,0)) delete from dbo.tbl_CS_notes_descr where (fk_serialNo = @fk_serialNo and fk_ticketNo = @fk_ticketNo)
Thank you,
RachComment
Comment