473,383 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

displaying previously entered multiple fields

769 512MB
Hey Everyone,

Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place.

what i am trying to display previously entered multiple fields. I am able to get my serial fields to display correctly, but i can not display my parts fields correctly.

Currently this is what it does

serial information 1
parts 1
parts 2

serial information 2
parts 1
parts 2

and what it needs to do

serial information 1
parts 1
serial information 2
parts 1

the problem is instead of the part going with the correct serial. it basically puts the information for both parts i added under both of the 2 serials I am also having trouble deleting fields an adding fields for the parts fields.

if someone could explain what i am doing wrong with the parts i would really appreciate it. I know it has to do with the count, just not sure what i am doing wrong


here is the javascript for serial and parts that allows me to add serials and parts

Expand|Select|Wrap|Line Numbers
  1. <!---Allows us to add serial information multiple times --->
  2. <script type="text/javascript">
  3. <!---Allows us to add multiple fields --->
  4. function addInput(divName){
  5. var dynamic = document.getElementById('dynamicInput');
  6. var thevalue = document.getElementById('theValue');
  7. var count = (document.getElementById('theValue').value -1)+ 2;
  8. thevalue.value = count;
  9. var newdiv = document.createElement('div');
  10. var getparts = document.createElement('div');
  11. var divIdName = 'dynamic'+count+'Input';
  12. var partc = 'partscount'+count;
  13.  
  14. newdiv.setAttribute('id',divIdName);
  15.  
  16. <!--- Adds Extra fields for Model No, Product Type, and Type of Hardware Failure  --->
  17. newdiv.innerHTML =
  18. "<table class='zpExpandedTable' id='modeltable'>" +
  19. "<th class='sectiontitletick' colspan='7'>Serial Information "+ count +" </th>" +
  20. "<tr>" +
  21. "<td id='paddingformultitop'>Model No:&nbsp;&nbsp;&nbsp;&nbsp;</td>" +
  22. "</td>" +
  23. "<td>" +
  24.  "<select name='modelno_" + count + "' >" +
  25.  "<option value=''>Make A Selection</option>" +
  26. "<cfoutput query='models'>" + 
  27. "<option value='#model#'>#model#</option>" + 
  28. "</cfoutput>" + 
  29.  "</select>" +
  30.  "</td>" +
  31.  "<td>" +
  32. "&nbsp;&nbsp;&nbsp;&nbsp;Product Type:"  +
  33. "</td>" +
  34. "<td>" +
  35. "<select name='producttype_" + count + "'>" +
  36. "<option value='' selected>No Choice</option>" +
  37. "<cfoutput query='getProdType'>" + 
  38. "<option value='#pk_productType#'>#pk_productType#</option>" + 
  39. "</cfoutput>" + 
  40. "</select>" +
  41. "</td>" +
  42. "<td class='red'>" +
  43. "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type Of Hardware Failure*:" +
  44. "</td>" +
  45. "<td>" +
  46. "<select name='hardwarefailure_" + count + "'>" +
  47. "<option value='' selected>Make A Selection</option>" +
  48. "<cfoutput query='getHardwareFail'>" +
  49. "<option value='#pk_hardwareFailure#'>#pk_hardwareFailure#</option>" +
  50. "</cfoutput>" +
  51. "</select>" +
  52. "</td>" +
  53. "</tr>" +
  54. "<table>";
  55.  
  56. <!--- Adds Extra fields for Serial Number and Software/Hardware  --->
  57. newdiv.innerHTML = newdiv.innerHTML +
  58. "<table class='zpExpandedTable' id='modeltable'>" +
  59. "<tr>" +
  60. "<td id='paddingformultitop'>" +
  61. "Serial Number:&nbsp;&nbsp;" +
  62. "<input type='text' name='serialnum_" + count + "'>" +
  63. "&nbsp;&nbsp;&nbsp;&nbsp;Software/Hardware:&nbsp;&nbsp;" +
  64. "<select name='softhardware_" + count + "'>" +
  65. "<option value='' selected>No Choice</option>" +
  66. "<cfoutput query='getSoftHard'>" + 
  67. "<option value='#pk_softwareHardware#'>#pk_softwareHardware#</option>" + 
  68. "</cfoutput>" + 
  69. "</select>" +
  70. "</td>" +
  71. "</tr>" +
  72. "</table>";
  73.  
  74. <!--- Adds Extra fields for Description  --->
  75. newdiv.innerHTML = newdiv.innerHTML + 
  76. "<table class='zpExpandedTable' id='resoltable' cellpadding='3' cellspacing='0'>" +
  77. "<tr>" +
  78. "<td id='paddingformutli'>" +
  79. "Description:&nbsp;&nbsp;" + 
  80. "</td>" +
  81. "<td class='descriptionmoveinmulti'>" +
  82. "( You may enter up to 1000 characters. )"+
  83. "<br>" +
  84. "<textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name='thedescription_" + count + "'></textarea>" +
  85. "</td>" +
  86. "</tr>" +
  87. "</table>";
  88.  
  89. <!--- Adds Extra fields for Resolution  --->
  90. newdiv.innerHTML = newdiv.innerHTML +
  91. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  92. "<tr>" +
  93. "<td id='paddingformutli'>" +
  94. "Resolution:&nbsp;&nbsp;" +
  95. "</td>" +
  96. "<td class='resolutionmoveinmulti'>" +
  97. "( You may enter up to 1500 characters. )"+
  98. "<br>" +
  99. "<textarea maxlength='1500' onkeyup='return resolutionmaxlength(this)' onkeydown='return resolutionmaxlength(this)' rows='4' cols='60' name='resolution_" + count + "'></textarea>" +
  100. "</td>" +
  101. "</tr>" +
  102. "</table>";
  103.  
  104. <!--- Adds Extra fields for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by  --->
  105. newdiv.innerHTML = newdiv.innerHTML +
  106. "<table class='zpExpandedTable' id='resoldatetab' cellpadding='1' cellspacing='0'>" +
  107. "<tr>" +
  108. "<td id='paddingformultitop'>" +
  109. "Resolution Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;" +
  110. "</td>" +
  111. "<td>" +
  112. "<input type='text' name='resdate_" + count + "' value=''  >&nbsp;&nbsp;" +
  113.  
  114. "&nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;" +
  115. "<input type='checkbox' name='currentdateresol_" + count + "' onClick=resdate_" + count + ".value=fill_date()>" +
  116. "</td>" +
  117. "<td>" +
  118. "Resolution Verified as effective by:&nbsp;&nbsp;"  +
  119. "</td>" +
  120. "<td>" +
  121. "<select name='resvertified_" + count + "'>" +
  122. "<option value='' selected>Make A Selection</option>" +
  123. "<cfoutput query='gettech'><option value='#fname# #lname#'>#fname# #lname#</option></cfoutput>" +
  124. "</select>" +
  125. "</td>" +
  126. "</tr>" +
  127. "</table>";
  128.  
  129. <!--- Adds Extra fields for Vertification Date, Current Date (for vertification date) and resolution vertified as effective by  --->
  130. newdiv.innerHTML = newdiv.innerHTML +
  131. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  132. "<tr>" +
  133. "<td id='paddingformultitop'>" +
  134. "Verification Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;" +
  135. "</td>" +
  136. "<td class='vertificationmoveinmulti'>" +
  137. "<input type='text' name='vertifidate_" + count + "'>&nbsp;&nbsp;" +
  138. "&nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;" +
  139. "<input type='checkbox' name='currentdatevert_" + count + "' onClick=vertifidate_" + count + ".value=fill_date()>" +
  140. "</td>" +
  141. "</tr>" +
  142. "</table>";
  143.  
  144. <!--- Adds Extra fields for Dept/Vendor Responsibility  --->
  145. newdiv.innerHTML = newdiv.innerHTML +
  146. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  147. "<tr>" +
  148. "<td class='red' id='paddingformultitop'>" +
  149. "Dept/Vendor Responsibility*:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"  +
  150. "<select name='deptvendor_" + count + "'>" +
  151. "<option value='' selected>Make A Selection</option>" +
  152. "<cfoutput query='getDeptVendor'>" +
  153. "<option value='#pk_deptVendor#'>#pk_deptVendor#</option>" +
  154. " </cfoutput>" +
  155. "</select>" +
  156. "</td>" +
  157. "</tr>" +
  158. "</table>";
  159.  
  160. <!--- Adds Extra fields for RMA Data Only  --->
  161. newdiv.innerHTML = newdiv.innerHTML +
  162. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  163. "<tr>" +
  164. "<td id='paddingformultitop'>" +
  165. "RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;" +
  166. "</td>" +
  167. "<td class='rmanmoveinmulti'>" +
  168. "( You may enter up to 1000 characters. )"+
  169. "<br/>" +
  170. "<textarea maxlength='1000' onkeyup='return rmamaxlength(this)' onkeydown='return rmamaxlength(this)' rows='4' cols='60' name='rma_" + count + "'></textarea> " +
  171. "</td>" +
  172. "</tr>" +
  173. "</table>" +
  174. "<input type='hidden' name='"+partc+"' id='"+partc+"' value='0'>" +
  175. "<input type='hidden' name='serialcount' id='serialcount' value='" + count + "'>";
  176.  
  177. <!--- Adds Delete to every ticket  --->
  178. newdiv.innerHTML = newdiv.innerHTML +
  179. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  180. "<tr>" +
  181. "<td>" +
  182. "<input type='button' class='removeticket' value='Remove Serial &quot;"+ count +"&quot;' onclick=\"removeElement(\'"+divIdName+"\')\"></a>" +
  183. "</td>" +
  184. "</tr>" +
  185. "<tr>" +
  186. "<td>" + 
  187. "<input type='button' class='addticket' value='Add Parts' onclick=\"addpartInput(\'"+divIdName+"\')\">" +
  188. "</td>" +
  189. "</tr>" +
  190. "</table>";
  191.  
  192. document.getElementById(divName).appendChild(newdiv);
  193.  
  194. <!---Allows us to remove multiple fields --->
  195. function removeElement(divNum) {
  196.   var d = document.getElementById('dynamicInput');
  197.   var olddiv = document.getElementById(divNum);
  198.   d.removeChild(olddiv);
  199. }
  200. </script>
  201.  
  202.  
  203.  
  204.  
  205.  
  206. <!---Allows us to add PARTS information multiple times--->
  207. <script type="text/javascript">
  208. <!---Adds multiple fields for parts --->
  209. function addpartInput(partName){
  210. var parts = document.getElementById(partName);
  211. <!---('partsInput')--->
  212.  
  213. <!---this works if only want to add a part under the serial you are working with, but if you have
  214. serial information 1
  215. 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--->
  216. var getparts = document.getElementById('div');
  217. <!---var avalue = document.getElementById('aValue');--->
  218. var serialno = partName.replace("dynamic","").replace("Input","");
  219. var avalue = document.getElementById("partscount"+serialno);
  220. <!---var count = (document.getElementById('avalue').value -1)+ 2;--->
  221. var count = parseInt(avalue.value) + 1;
  222. avalue.value = count;
  223. var partdiv = document.createElement('div');
  224. <!---var partIdName = 'part'+count+'Name';--->
  225. var partIdName = 'part' + count + 'Name' + serialno;
  226. <!---'parts'+count+'Input'--->
  227.  
  228. partdiv.setAttribute('id',partIdName);
  229.  
  230. <!--- Adds Extra fields for parts table  --->
  231. partdiv.innerHTML =
  232. <!---what used originally for this tableclass='createticketables' id='spaceup'--->
  233. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' >" +
  234. "<th class='sectiontitle' colspan='7'>Parts Information "+ count +" Serial Information "+serialno+"</th>" +
  235. "<tr>" +
  236. "<td class='indent' id='formfieldpadding'>HC P/N:&nbsp;&nbsp;&nbsp;" +
  237. "<input type='text' name='hcpn_" + count + "_"+serialno+"' style='margin:0px'></td>" +
  238. "<td class='red'>" +
  239. "Parts been returned* " +
  240. "<input type='checkbox' name='partsreturn_" + count + "_"+serialno+"' value='1'>" +
  241. "</td>" +
  242. "<td>" +
  243. "<td class='indent'>Defective<input type='checkbox' name='defective_" + count +"_"+serialno+"' value='1'>" +
  244. "</td>" +
  245. "</td>" +
  246. "</tr>" +
  247. "</table>";
  248. <!---"<table table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'  >" +
  249. "<tr>" +
  250. "<td class='indent' id='formfieldpadding'>Follow up Date:(MM/DD/YYYY)&nbsp;&nbsp;&nbsp;"  +
  251. "<input type='text' name='followdate_" + count + "' value='' size='8'/>&nbsp;&nbsp;&nbsp;" +
  252. "Current Date<input type='checkbox' name='followcheck_"+ count +"' value='' onClick='followdate.value=fill_date()'/></td>" +
  253. "<td>On Site:</td>" +
  254. "<td><select name='onsite_" + count +"'>" +
  255. "<option value='No Choice' selected>No Choice</option>" +
  256. "<option value='Yes'>Yes</option>" +
  257. "<option value='No'>No</option>" +
  258. "</select><td>" +
  259. "<td># of Onsite:</td><td><select name='numonsite_" + count +"'>" +
  260. "<option value='' selected>No Choice</option>" +
  261. "<cfloop from='0' to='10' index='nonsite'><cfoutput>" +
  262. "<option value='#nonsite#'>#nonsite#</option></cfoutput></cfloop>" +
  263. "</select><td>" +
  264. "</tr>" +
  265. "</table>";
  266. --->
  267.  
  268. <!--- Adds Delete to every ticket  --->
  269. partdiv.innerHTML = partdiv.innerHTML +
  270. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  271. "<tr>" +
  272. "<td>" +
  273. "<input type='button' class='removeticket' value='Remove Parts &quot;"+count +"&quot;' onclick=\"removetheElement(\'"+partIdName+"\')\"></a>" +
  274. "</td>" +
  275. "</td>" +
  276. "</tr>" +
  277. "</table>";
  278.  
  279. document.getElementById(partName).appendChild(partdiv);
  280.  
  281. <!---Allows us to remove multiple fields--->
  282. function removetheElement(divNum) {
  283.   var d = document.getElementById('partsInput');
  284.   var olddiv = document.getElementById(divNum);
  285.  olddiv.parentNode.removeChild(olddiv);
  286. }
  287.  
  288. </script>
  289.  
  290.  


here is the html/coldfusion that displays what was previously entered for serials and parts.
Expand|Select|Wrap|Line Numbers
  1. <!--- Ticket Information 
  2.        This display the ticket Information--->
  3.  
  4. <!---<input type="hidden" value="0" id="theValue" />--->
  5.     <div id="dynamicInput"> 
  6.      <!--- All Ticket Information Appears Here--->
  7.  
  8.  
  9.     <!--- Shows what was previously entered for Model No, Product Type, and Type of Hardware Failure  --->
  10. <cfset count = 0>
  11. <!---<cfif serial.recordcount is 0>--->
  12. <cfoutput query="serial">
  13. <cfset model_no = #model_no#>
  14. <cfset product_type = #product_type#>
  15. <cfset type_hardware_failure = #type_hardware_failure#>
  16. <cfset software_hardware = #software_hardware#>
  17. <cfset resolution_verified_by = #resolution_verified_by#>
  18. <cfset dept_responsibility = #dept_responsibility#>
  19. <cfset count = count + 1>
  20. <div id="dynamic#count#Input">
  21. <table class="zpExpandedTable" id="modeltable"> 
  22. <th class="sectiontitletick" colspan="7">
  23. Serial Information #count# </th>
  24. <tr>
  25. <td id="paddingformultitop">Model No:&nbsp;&nbsp;&nbsp;&nbsp;</td>
  26. </td>
  27. <td>
  28. <select name="modelno_#count#">
  29. <option value="">Make A Selection</option>
  30. <cfloop query="models">
  31. <option value="#model#"<cfif #model# is #model_no#>selected</cfif>>#model#</option>
  32. </cfloop> 
  33. </select>
  34. </td>
  35. <td>
  36. &nbsp;&nbsp;&nbsp;&nbsp;Product Type:
  37. </td>
  38. <td>
  39. <select name="producttype_#count#">
  40. <option value="" selected>No Choice</option>
  41. <cfloop query="getProdType">
  42. <option value="#pk_productType#"<cfif #pk_productType# is #product_type#>selected</cfif>>#pk_productType#</option> 
  43. </cfloop>
  44. </select>
  45. </td>
  46. <td class="red">
  47. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type Of Hardware Failure*:
  48. </td>
  49. <td>
  50. <select name="hardwarefailure_#count#">
  51. <option value="" selected>Make A Selection</option>
  52. <cfloop query="getHardwareFail">
  53. <option value="#pk_hardwareFailure#"<cfif #pk_hardwareFailure# is #type_hardware_failure#>selected</cfif>>#pk_hardwareFailure#</option>
  54. </cfloop>
  55. </select>
  56. </td>
  57. </tr>
  58. <table>
  59.  
  60. <!--- Shows what was previously entered for Serial Number and Software/Hardware  --->
  61. <table class="zpExpandedTable" id="modeltable">
  62. <tr>
  63. <td id="paddingformultitop">
  64. Serial Number:&nbsp;&nbsp;
  65. <input type="text" name="serialnum_#count#" value="#pka_serialNo#">
  66. &nbsp;&nbsp;&nbsp;&nbsp;Software/Hardware:&nbsp;&nbsp;
  67. <select name="softhardware_#count#">
  68. <option value="" selected>No Choice</option>
  69. <cfloop query="getSoftHard">
  70. <option value="#pk_softwareHardware#"<cfif #pk_softwareHardware# is #software_hardware#>selected</cfif>>#pk_softwareHardware#</option>
  71. </cfloop>
  72. </select>
  73. </td>
  74. </tr>
  75. </table>
  76.  
  77. <!--- Shows what was previously entered for Description ---> 
  78.  
  79. <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
  80. <tr>
  81. <td id="paddingformutli">
  82. Description:&nbsp;&nbsp;
  83. </td>
  84. <td class="descriptionmoveinmulti">
  85. #description#
  86. ( You may enter up to 1000 characters. )
  87. <br>
  88. <textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name="thedescription_#count#"></textarea>
  89. </td>
  90. </tr>
  91. </table>
  92.  
  93. <!---Shows what was previously entered for Resolution  --->
  94.  
  95. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  96. <tr>
  97. <td id="paddingformutli">
  98. Resolution:&nbsp;&nbsp;
  99. </td>
  100. <td class="resolutionmoveinmulti">
  101. ( You may enter up to 1500 characters. )
  102. <br>
  103. <textarea  maxlength="1500" onkeyup="return resolutionismaxlength(this)" onkeydown="return resolutionismaxlength(this)" rows="4" cols="60" name="resolution_#count#">#resolution#</textarea>
  104. </td>
  105. </tr>
  106. </table>
  107.  
  108. <!--- Shows what was previously entered for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by  --->
  109.  
  110. <table class="zpExpandedTable" id="resoldatetab" cellpadding="1" cellspacing="0">
  111. <tr>
  112. <td id="paddingformultitop">
  113. Resolution Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
  114. </td>
  115. <td>
  116. <input type="text" name="resdate_#count#" value="#DateFormat(resolution_date,'mm/dd/yyyy')#">&nbsp;&nbsp;
  117. &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
  118. <input type="checkbox" name="currentdateresol_#count#" 
  119. onClick="resdate_#count#.value=fill_date()">
  120. </td>
  121. <td>
  122. Resolution Verified as effective by:&nbsp;&nbsp;
  123. </td>
  124. <td>
  125. <select name="resvertified_#count#">
  126. <option value="" selected>Make A Selection</option>
  127. <cfloop query="gettech">
  128. <option value="#fname# #lname#"<cfif "#fname# #lname#" is #resolution_verified_by#>
  129. selected</cfif>>#fname# #lname#</option>
  130. </cfloop>
  131. </select>
  132. </td>
  133. </tr>
  134. </table>
  135. <!--- Shows what was previously entered for Vertification Date, Current Date (for vertification date)   --->
  136. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  137. <tr>
  138. <td id="paddingformultitop">
  139. Verification Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
  140. </td>
  141. <td class="vertificationmoveinmulti">
  142. <input type="text" name="vertifidate_#count#" value="#DateFormat(verification_date,'mm/dd/yyyy')#">&nbsp;&nbsp;
  143. &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
  144. <input type="checkbox" name="currentdatevert_#count#" 
  145. onClick="vertifidate_#count#.value=fill_date()">
  146. </td>
  147. </tr>
  148. </table>
  149.  
  150. <!--- Shows what was previously entered for Dept/Vendor Responsibility  --->
  151. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  152. <tr>
  153. <td class="red" id="paddingformultitop">
  154. Dept/Vendor Responsibility*:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  155. <select name="deptvendor_#count#">
  156. <option value="" selected>Make A Selection</option>
  157. <cfloop query="getDeptVendor">
  158. <option value="#pk_deptVendor#"<cfif #pk_deptVendor# is #dept_responsibility#>selected</cfif>>#pk_deptVendor#</option>
  159. </cfloop>
  160. </select>
  161. </td>
  162. </tr>
  163. </table>
  164.  
  165. <!--- Shows what was previously entered for RMA Data Only  --->
  166. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  167. <tr>
  168. <td id="paddingformultitop">
  169. RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;
  170. </td>
  171. <td class="rmanmoveinmulti">
  172. ( You may enter up to 1000 characters. )
  173. <br/>
  174. <textarea maxlength="1000" onkeyup="return rmaismaxlength(this)" onkeydown="return rmaismaxlength(this)" rows="4" cols="60" name="rma_#count#" >#rma_data#</textarea>
  175. </td>
  176. </tr>
  177. </table>
  178. <input type="hidden" name="serialcount" value="#count#">
  179.  
  180. <!--- Adds Delete to every ticket  --->
  181. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  182. <tr>
  183. <td>
  184. <input type="button" class="removeticket" value="Remove Serial #count#" onclick="removeElement('dynamic#count#Input')">
  185. </td>
  186. </tr>
  187. <tr>
  188. <td>
  189. <!---<input type='button' class='addticket' value='Add Parts' onclick="addpartInput('divIdName')">--->
  190. </td>
  191. </tr>
  192. </table>
  193.  
  194. <cfset count1 = 0>
  195. <!---<cfif serial.recordcount is 0>--->
  196. <cfloop query="parts">
  197. <cfset count1 = count1 + 1>
  198. <!---THIS IS THE PARTS SECTION--->
  199. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  200. <th class="sectiontitle" colspan="7">Parts Information #count1# Serial Information #count#</th>
  201. <tr>
  202. <td class='indent' id='formfieldpadding'>HC P/N:&nbsp;&nbsp;&nbsp;<input type='text' name="hcpn_#count1#" style="margin:0px" value="#hc_partNo#"></td>
  203. <td class="red">
  204. Parts been returned*
  205. <input type="checkbox" name="partsreturn_#count1#" value="#part_returned#"<cfif #part_returned# eq "1">checked=yes</cfif>/>
  206. </td>
  207. <td>
  208. <td class="indent">Defective<input type="checkbox" name="defective_#count#1" value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/></td>
  209. </td>
  210. </tr>
  211. </table>
  212.  
  213. <!--- Adds Delete to every ticket  --->
  214. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  215. <tr>
  216. <td>
  217. <input type="button" class="removeticket" value="Remove Parts #count1#" 
  218. onclick="removetheElement('partIdName')"></a>
  219. </td>
  220. </td>
  221. </tr>
  222. </table>
  223. </cfloop>
  224. </div>
  225. </cfoutput>
  226. <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
  227.  
  228.  
  229. <!---If have any blanks in serial table it will make field appear--->
  230. <cfoutput query="serial">
  231. <cfset model_no = #model_no#>
  232. <cfset product_type = #product_type#>
  233. <cfset type_hardware_failure = #type_hardware_failure#>
  234. <cfset pka_serialNo = #pka_serialNo#>
  235. <cfset software_hardware = #software_hardware#>
  236. <cfset description = #description#>
  237. <cfset resolution = #resolution#>
  238. <cfset resolution_date = #resolution_date#>
  239. <cfset resolution_verified_by = #resolution_verified_by#>
  240. <cfset verification_date = #verification_date#>
  241. <cfset dept_responsibility = #dept_responsibility#>
  242. <cfset rma_data = #rma_data#>
  243. </cfoutput>
  244. <cfif serial.recordcount is 0>
  245. <cfset model_no = "">
  246. <cfset product_type = "">
  247. <cfset type_hardware_failure = "">
  248. <cfset pka_serialNo = "">
  249. <cfset software_hardware = "">
  250. <cfset description = "">
  251. <cfset resolution = "">
  252. <cfset resolution_date = "">
  253. <cfset resolution_verified_by = "">
  254. <cfset verification_date = "">
  255. <cfset dept_responsibility = "">
  256. <cfset rma_data = "">
  257. <cfinclude template="serialdisplay.cfm">
  258. </cfif>
  259. <!---
  260. <cfset count = 0>
  261. <cfoutput query="parts">
  262. <cfset count = count + 1>
  263. <div id="partscount#count#">
  264.  
  265. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  266. <tr>
  267. <td class="indent" id="formfieldpadding">Follow up Date:(MM/DD/YYYY)&nbsp;&nbsp;&nbsp;
  268. <input type="text" name="followdate_#count#" value="" size="8"/>&nbsp;&nbsp;&nbsp;
  269. Current Date<input type="checkbox" name="followcheck_#count#" value="" onClick="followdate.value=fill_date()"/></td>
  270. <td>On Site:</td>
  271. <td><select name="onsite_#count#">
  272. <option value="No Choice" selected>No Choice</option>
  273. <option value="Yes">Yes</option>
  274. <option value="No">No</option>
  275. </select><td>
  276. <td># of Onsite:</td><td><select name="numonsite_#count#">
  277. <option value="" selected>No Choice</option>
  278. <cfloop from="0" to="10" index="nonsite"><cfoutput>
  279. <option value="#nonsite#">#nonsite#</option></cfoutput></cfloop>
  280. </select><td>
  281. </tr>
  282. </table>
  283. <input type="hidden" name="serialcount" value="#count#">
  284.  
  285.  
  286.  
  287.  
  288. <!--- Parts Information, display parts if have or don't have a value --->
  289. <cfoutput query="parts">
  290. <cfset hc_partNo = #hc_partNo#>
  291. <cfset part_returned = #part_returned#>
  292. <cfset defective = #defective#>
  293. <cfinclude template="partsdisplay.cfm">
  294. </cfoutput>
  295. <cfif parts.recordcount is 0>
  296. <cfset hc_partNo = "">
  297. <cfset part_returned = "">
  298. <cfset defective = "">
  299. <cfoutput><cfinclude template="partsdisplay.cfm"></cfoutput>
  300. </cfif>
  301.  
  302. ---></div>
  303.      <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
  304.  
  305.  
Thank you in advance,
Rach
Oct 16 '08
482 27220
acoder
16,027 Expert Mod 8TB
I don't know where default came from. That should be index.
Oct 24 '08 #101
bonneylake
769 512MB
I don't know where default came from. That should be index.
Hey Acoder,

My bad got the index and default confused. But ok here is what i have, is everything else correct?
Expand|Select|Wrap|Line Numbers
  1. <cfloop list="1" to="#form['part2count' & machinecount]#" index="ps">
  2. <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
  3. <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
  4.  <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
  5.  <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
  6.  <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
  7.  <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
  8. <cfquery name="parts" datasource="CustomerSupport">
  9.     exec usp_CS_Insertparts 
  10.     <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  11.     '#Form.pk_ticketID#',
  12.     <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
  13.     <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
  14.     <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">,
  15.     <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">
  16. </cfquery>
  17. </cfloop>
Thank you,
Rach
Oct 24 '08 #102
acoder
16,027 Expert Mod 8TB
Seems so - you can only test and find out.
Oct 24 '08 #103
bonneylake
769 512MB
Seems so - you can only test and find out.
Hey Acoder,

I tested it twice an got the error.

Error Diagnostic Information

An error occurred while evaluating the expression:


hcpn = Form["hcpn_" & ps & "_#machinecount#"]


Error near line 95, column 8.
--------------------------------------------------------------------------------

The member "HCPN_1_1" in dimension 1 of object "Form" cannot be found. Please, modify the member name.

i was wondering could it be becuase of this line, becuase i have the value as nothing instead of 0 like the rest?

"<input type='hidden' name='"+part2c+"' id='"+part2c+"' value=''>" +


here is what i have

Expand|Select|Wrap|Line Numbers
  1. <cfloop list="#form['part2count' & machinecount]#" index="ps">
  2. <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
  3. <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
  4.  <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
  5.  <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
  6.  <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
  7.  <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
  8. <cfquery name="parts" datasource="CustomerSupport">
  9.     exec usp_CS_Insertparts 
  10.     <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  11.     '#Form.pk_ticketID#',
  12.     <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
  13.     <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
  14.     <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">,
  15.     <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">
  16. </cfquery>
  17. </cfloop>
Thank you,
Rach
Oct 24 '08 #104
acoder
16,027 Expert Mod 8TB
This would be when there's no parts obviously. Check what the value of part2count1 is. It should be empty when there are no parts.
Oct 24 '08 #105
bonneylake
769 512MB
This would be when there's no parts obviously. Check what the value of part2count1 is. It should be empty when there are no parts.
Hey Acoder,

well my thinking cap was not on an it is working how its suppose to. However, i ran into another problem with it :(. The user has to be able to add parts to some serials an not add parts to other serials, is this possible?

Thank you,
Rach
Oct 24 '08 #106
acoder
16,027 Expert Mod 8TB
You mean allow for no parts to be added to any serial or even all serials? Yes, that should be possible.
Oct 24 '08 #107
bonneylake
769 512MB
You mean allow for no parts to be added to any serial or even all serials? Yes, that should be possible.
Hey Acoder,

thats not quite what i mean. Right now i tested one serial with a part an another serial without a part. An i got an error with that (same one i been having). However, if every serial has a part and or every serial does not have a part it works right.So basically wondering if we can make it where it will still submit if one serial has a part an another serial does not have a part?

Thank you,
Rach
Oct 24 '08 #108
acoder
16,027 Expert Mod 8TB
Yes, that should be possible. It should be working with the current code, but something's probably missing. When you have one serial with one part and one serial with no parts, check the values of part2count1 and part2count2.
Oct 24 '08 #109
bonneylake
769 512MB
Yes, that should be possible. It should be working with the current code, but something's probably missing. When you have one serial with one part and one serial with no parts, check the values of part2count1 and part2count2.
Hey Acoder,

Ok i need to stop working on so many things at the same time. I figured out the problem an IT IS working correctly! i ended up changing one thing i didn't need to change. But THANK YOU THANK YOU!!!! However, i am having another problem that i was hoping you could explain (an it has to do with displaying previously submitted information). I figured out how to do the insert update stored procedure. An updating is working beautifully, but the inserting only does when you do it a certain way. But here is the trouble i am having.

1) if i go back to view a serial or part. an let say i have 1 serial an i edited to change one field. Anyway when i go back to view it again (with the new changes) instead of it showing the one serial with the change it shows the one serial with the change an then adds another serial (but yet the another serial does not appear in the table i am inserting into.

2)an also if i add a serial/part it will not be inserted into the table. Unless i change the serial name of a previously inserted serial then it will insert. But if i use javascript to add another it will not insert.

but if you could explain those 2 that would be awesome. Which i am sorry i have made this thread so long. This is just a confusing one.

Thank you,
Rach
Oct 24 '08 #110
acoder
16,027 Expert Mod 8TB
So you're saying this all works fine if you don't update, but once you update a serial or part field, you start to have these problems? Show the update code.
Oct 25 '08 #111
bonneylake
769 512MB
So you're saying this all works fine if you don't update, but once you update a serial or part field, you start to have these problems? Show the update code.
Hey Acoder,

Yes i have the problem when i update previously submitted fields. But i also have the problem where if i try to add new serials and parts it will not insert it into the table, it will update old ones. But it will not insert new ones unless i take a old submitted serial and clear it out an put the new information in it.

But here is what i have for the update

here is the javascript for both serial and parts
Expand|Select|Wrap|Line Numbers
  1. <!---Allows us to add serial information multiple times --->
  2. <script type="text/javascript">
  3. <!---Allows us to add multiple fields --->
  4. function addInput(divName){
  5. var dynamic = document.getElementById('dynamicInput');
  6. var thevalue = document.getElementById('theValue');
  7. var count = (document.getElementById('theValue').value -1)+ 2;
  8. thevalue.value = count;
  9. var newdiv = document.createElement('div');
  10. var getparts = document.createElement('div');
  11. var divIdName = 'dynamic'+count+'Input';
  12. var partc = 'partscount'+count;
  13. var part2c = 'part2count'+count;
  14.  
  15. newdiv.setAttribute('id',divIdName);
  16.  
  17. <!--- Adds Extra fields for Model No, Product Type, and Type of Hardware Failure  --->
  18. newdiv.innerHTML =
  19. "<table class='zpExpandedTable' id='modeltable'>" +
  20. "<th class='sectiontitletick' colspan='7'>Serial Information "+ count +" </th>" +
  21. "<tr>" +
  22. "<td id='paddingformultitop'>Model No:&nbsp;&nbsp;&nbsp;&nbsp;</td>" +
  23. "</td>" +
  24. "<td>" +
  25.  "<select name='modelno_" + count + "' >" +
  26.  "<option value=''>Make A Selection</option>" +
  27. "<cfoutput query='models'>" + 
  28. "<option value='#model#'>#model#</option>" + 
  29. "</cfoutput>" + 
  30.  "</select>" +
  31.  "</td>" +
  32.  "<td>" +
  33. "&nbsp;&nbsp;&nbsp;&nbsp;Product Type:"  +
  34. "</td>" +
  35. "<td>" +
  36. "<select name='producttype_" + count + "'>" +
  37. "<option value='' selected>No Choice</option>" +
  38. "<cfoutput query='getProdType'>" + 
  39. "<option value='#pk_productType#'>#pk_productType#</option>" + 
  40. "</cfoutput>" + 
  41. "</select>" +
  42. "</td>" +
  43. "<td class='red'>" +
  44. "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type Of Hardware Failure*:" +
  45. "</td>" +
  46. "<td>" +
  47. "<select id='hardwarefailure' name='hardwarefailure_" + count + "'>" +
  48. "<option value='' selected>Make A Selection</option>" +
  49. "<cfoutput query='getHardwareFail'>" +
  50. "<option value='#pk_hardwareFailure#'>#pk_hardwareFailure#</option>" +
  51. "</cfoutput>" +
  52. "</select>" +
  53. "</td>" +
  54. "</tr>" +
  55. "<table>";
  56.  
  57. <!--- Adds Extra fields for Serial Number and Software/Hardware  --->
  58. newdiv.innerHTML = newdiv.innerHTML +
  59. "<table class='zpExpandedTable' id='modeltable'>" +
  60. "<tr>" +
  61. "<td id='paddingformultitop'>" +
  62. "Serial Number:&nbsp;&nbsp;" +
  63. "<input type='text' name='serialnum_" + count + "'>" +
  64. "&nbsp;&nbsp;&nbsp;&nbsp;Software/Hardware:&nbsp;&nbsp;" +
  65. "<select name='softhardware_" + count + "'>" +
  66. "<option value='' selected>No Choice</option>" +
  67. "<cfoutput query='getSoftHard'>" + 
  68. "<option value='#pk_softwareHardware#'>#pk_softwareHardware#</option>" + 
  69. "</cfoutput>" + 
  70. "</select>" +
  71. "</td>" +
  72. "</tr>" +
  73. "</table>";
  74.  
  75. <!--- Adds Extra fields for Description  --->
  76. newdiv.innerHTML = newdiv.innerHTML + 
  77. "<table class='zpExpandedTable' id='resoltable' cellpadding='3' cellspacing='0'>" +
  78. "<tr>" +
  79. "<td id='paddingformutli'>" +
  80. "Description:&nbsp;&nbsp;" + 
  81. "</td>" +
  82. "<td class='descriptionmoveinmulti'>" +
  83. "( You may enter up to 1000 characters. )"+
  84. "<br>" +
  85. "<textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name='thedescription_" + count + "'></textarea>" +
  86. "</td>" +
  87. "</tr>" +
  88. "</table>";
  89.  
  90. <!--- Adds Extra fields for Resolution  --->
  91. newdiv.innerHTML = newdiv.innerHTML +
  92. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  93. "<tr>" +
  94. "<td id='paddingformutli'>" +
  95. "Resolution:&nbsp;&nbsp;" +
  96. "</td>" +
  97. "<td class='resolutionmoveinmulti'>" +
  98. "( You may enter up to 1500 characters. )"+
  99. "<br>" +
  100. "<textarea maxlength='1500' onkeyup='return resolutionmaxlength(this)' onkeydown='return resolutionmaxlength(this)' rows='4' cols='60' name='resolution_" + count + "'></textarea>" +
  101. "</td>" +
  102. "</tr>" +
  103. "</table>";
  104.  
  105. <!--- Adds Extra fields for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by  --->
  106. newdiv.innerHTML = newdiv.innerHTML +
  107. "<table class='zpExpandedTable' id='resoldatetab' cellpadding='1' cellspacing='0'>" +
  108. "<tr>" +
  109. "<td id='paddingformultitop'>" +
  110. "Resolution Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;" +
  111. "</td>" +
  112. "<td>" +
  113. "<input type='text' name='resdate_" + count + "' value=''  >&nbsp;&nbsp;" +
  114.  
  115. "&nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;" +
  116. "<input type='checkbox' name='currentdateresol_" + count + "' onClick=resdate_" + count + ".value=fill_date()>" +
  117. "</td>" +
  118. "<td>" +
  119. "Resolution Verified as effective by:&nbsp;&nbsp;"  +
  120. "</td>" +
  121. "<td>" +
  122. "<select name='resvertified_" + count + "'>" +
  123. "<option value='' selected>Make A Selection</option>" +
  124. "<cfoutput query='gettech'><option value='#fname# #lname#'>#fname# #lname#</option></cfoutput>" +
  125. "</select>" +
  126. "</td>" +
  127. "</tr>" +
  128. "</table>";
  129.  
  130. <!--- Adds Extra fields for Vertification Date, Current Date (for vertification date) and resolution vertified as effective by  --->
  131. newdiv.innerHTML = newdiv.innerHTML +
  132. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  133. "<tr>" +
  134. "<td id='paddingformultitop'>" +
  135. "Verification Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;" +
  136. "</td>" +
  137. "<td class='vertificationmoveinmulti'>" +
  138. "<input type='text' name='vertifidate_" + count + "'>&nbsp;&nbsp;" +
  139. "&nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;" +
  140. "<input type='checkbox' name='currentdatevert_" + count + "' onClick=vertifidate_" + count + ".value=fill_date()>" +
  141. "</td>" +
  142. "</tr>" +
  143. "</table>";
  144.  
  145. <!--- Adds Extra fields for Dept/Vendor Responsibility  --->
  146. newdiv.innerHTML = newdiv.innerHTML +
  147. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  148. "<tr>" +
  149. "<td class='red' id='paddingformultitop'>" +
  150. "Dept/Vendor Responsibility*:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"  +
  151. "<select name='deptvendor_" + count + "' id='deptvendor'>" +
  152. "<option value='' selected>Make A Selection</option>" +
  153. "<cfoutput query='getDeptVendor'>" +
  154. "<option value='#pk_deptVendor#'>#pk_deptVendor#</option>" +
  155. " </cfoutput>" +
  156. "</select>" +
  157. "</td>" +
  158. "</tr>" +
  159. "</table>" +
  160. "<input type='hidden' name='"+partc+"' id='"+partc+"' value='0'>" +
  161. "<input type='hidden' name='"+part2c+"' id='"+part2c+"' value=''>" +
  162. "<input type='hidden' name='serialcount' id='serialcount' value='" + count + "'>";
  163.  
  164. <!--- Adds Delete to every ticket  --->
  165. newdiv.innerHTML = newdiv.innerHTML +
  166. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  167. "<tr>" +
  168. "<td>" +
  169. "<input type='button' class='removeticket' value='Remove Serial &quot;"+ count +"&quot;' onclick=\"removeElement(\'"+divIdName+"\')\"></a>" +
  170. "</td>" +
  171. "</tr>" +
  172. "<tr>" +
  173. "<td>" + 
  174. "<input type='button' class='addticket' value='Add Parts' onclick=\"addpartInput(\'"+divIdName+"\')\">" +
  175. "</td>" +
  176. "</tr>" +
  177. "</table>";
  178.  
  179. document.getElementById(divName).appendChild(newdiv);
  180.  
  181. <!---Allows us to remove multiple fields --->
  182. function removeElement(divNum) {
  183.   var d = document.getElementById('dynamicInput');
  184.   var olddiv = document.getElementById(divNum);
  185.   d.removeChild(olddiv);
  186. }
  187. </script>
  188.  
  189.  
  190.  
  191.  
  192.  
  193. <!---Allows us to add PARTS information multiple times--->
  194. <script type="text/javascript">
  195. <!---Adds multiple fields for parts --->
  196. function addpartInput(partName){
  197. var parts = document.getElementById(partName);
  198.  
  199.  
  200. var getparts = document.getElementById('div');
  201. var serialno = partName.replace("dynamic","").replace("Input","");
  202. var avalue = document.getElementById("partscount"+serialno);
  203. var count = parseInt(avalue.value) + 1;
  204. avalue.value = count;
  205. var partslist = document.getElementById("part2count"+serialno);
  206. partslist.value += count + ",";
  207. var partdiv = document.createElement('div');
  208. var partIdName = 'part' + count + 'Name' + serialno;
  209.  
  210. partdiv.setAttribute('id',partIdName);
  211.  
  212. <!--- Adds Extra fields for parts table  --->
  213. partdiv.innerHTML =
  214. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' >" +
  215. "<th class='sectiontitle' colspan='7'>Parts Information "+ count +" Serial Information "+serialno+"</th>" +
  216. "<tr>" +
  217. "<td class='indent' id='formfieldpadding'>HC P/N:&nbsp;&nbsp;&nbsp;" +
  218. "<input type='text' name='hcpn_" + count + "_"+serialno+"' style='margin:0px'></td>" +
  219. "<td>" +
  220. "Parts been returned* " +
  221. "<input type='checkbox' name='partsreturn_" + count + "_"+serialno+"' value='1'>" +
  222. "</td>" +
  223. "<td>" +
  224. "<td class='indent'>Defective<input type='checkbox' name='defective_" + count +"_"+serialno+"' value='1'>" +
  225. "</td>" +
  226. "</td>" +
  227. "</tr>" +
  228. "</table>";
  229.  
  230.  
  231. <!--- Adds Extra fields for RMA Data Only  --->
  232. partdiv.innerHTML = partdiv.innerHTML +
  233. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  234. "<tr>" +
  235. "<td id='paddingformultitop'>" +
  236. "RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;" +
  237. "</td>" +
  238. "<td class='rmanmoveinmulti'>" +
  239. "( You may enter up to 1000 characters. )"+
  240. "<br/>" +
  241. "<textarea maxlength='1000' onkeyup='return rmamaxlength(this)' onkeydown='return rmamaxlength(this)' rows='4' cols='60' name='rma_" + count + "_"+serialno+"'></textarea> " +
  242. "</td>" +
  243. "</tr>" +
  244. "</table>";
  245.  
  246.  
  247. <!--- Adds Delete to every ticket  --->
  248. partdiv.innerHTML = partdiv.innerHTML +
  249. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  250. "<tr>" +
  251. "<td>" +
  252. "<input type='button' class='removeticket' value='Remove Parts &quot;"+count +"&quot;' onclick=\"removetheElement('"+partIdName+"',"+serialno+","+count+")\"></a>" +
  253. "</td>" +
  254. "</td>" +
  255. "</tr>" +
  256. "</table>";
  257.  
  258. document.getElementById(partName).appendChild(partdiv);
  259.  
  260. <!---Allows us to remove multiple fields--->
  261. function removetheElement(divNum, serialno, partnum) {
  262.   var partslist = document.getElementById("part2count"+serialno);
  263.   partslist.value = partslist.value.replace(partnum+',',"");
  264.   var olddiv = document.getElementById(divNum);
  265.  olddiv.parentNode.removeChild(olddiv);
  266. }
  267.  
  268. </script>

an here is the html where the previously submitted fields appear

Expand|Select|Wrap|Line Numbers
  1. <!--- Ticket Information 
  2.        This display the ticket Information--->
  3.  
  4. <!---<input type="hidden" value="0" id="theValue" />--->
  5.     <div id="dynamicInput"> 
  6.      <!--- All Ticket Information Appears Here--->
  7.  
  8.  
  9.     <!--- Shows what was previously entered for Model No, Product Type, and Type of Hardware Failure  --->
  10. <cfset count = 0>
  11. <!---<cfif serial.recordcount is 0>--->
  12. <cfoutput query="serial">
  13. <cfset model_no = #model_no#>
  14. <cfset product_type = #product_type#>
  15. <cfset type_hardware_failure = #type_hardware_failure#>
  16. <cfset software_hardware = #software_hardware#>
  17. <cfset resolution_verified_by = #resolution_verified_by#>
  18. <cfset dept_responsibility = #dept_responsibility#>
  19. <cfset count = count + 1>
  20. <div id="dynamic#count#Input"> 
  21. <table class="zpExpandedTable" id="modeltable"> 
  22. <th class="sectiontitletick" colspan="7">
  23. Serial Information #count# </th>
  24. <tr>
  25. <td id="paddingformultitop">Model No:&nbsp;&nbsp;&nbsp;&nbsp;</td>
  26. </td>
  27. <td>
  28. <select name="modelno_#count#">
  29. <option value="">Make A Selection</option>
  30. <cfloop query="models">
  31. <option value="#model#"<cfif #model# is #model_no#>selected</cfif>>#model#</option>
  32. </cfloop> 
  33. </select>
  34. </td>
  35. <td>
  36. &nbsp;&nbsp;&nbsp;&nbsp;Product Type:
  37. </td>
  38. <td>
  39. <select name="producttype_#count#">
  40. <option value="" selected>No Choice</option>
  41. <cfloop query="getProdType">
  42. <option value="#pk_productType#"<cfif #pk_productType# is #product_type#>selected</cfif>>#pk_productType#</option> 
  43. </cfloop>
  44. </select>
  45. </td>
  46. <td class="red">
  47. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type Of Hardware Failure*:
  48. </td>
  49. <td>
  50. <select name="hardwarefailure_#count#">
  51. <option value="" selected>Make A Selection</option>
  52. <cfloop query="getHardwareFail">
  53. <option value="#pk_hardwareFailure#"<cfif #pk_hardwareFailure# is #type_hardware_failure#>selected</cfif>>#pk_hardwareFailure#</option>
  54. </cfloop>
  55. </select>
  56. </td>
  57. </tr>
  58. <table>
  59.  
  60. <!--- Shows what was previously entered for Serial Number and Software/Hardware  --->
  61. <table class="zpExpandedTable" id="modeltable">
  62. <tr>
  63. <td id="paddingformultitop">
  64. Serial Number:&nbsp;&nbsp;
  65. <input type="text" name="serialnum_#count#" value="#pka_serialNo#">
  66. &nbsp;&nbsp;&nbsp;&nbsp;Software/Hardware:&nbsp;&nbsp;
  67. <select name="softhardware_#count#">
  68. <option value="" selected>No Choice</option>
  69. <cfloop query="getSoftHard">
  70. <option value="#pk_softwareHardware#"<cfif #pk_softwareHardware# is #software_hardware#>selected</cfif>>#pk_softwareHardware#</option>
  71. </cfloop>
  72. </select>
  73. </td>
  74. </tr>
  75. </table>
  76.  
  77. <!--- Shows what was previously entered for Description ---> 
  78.  
  79. <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
  80. <tr>
  81. <td id="paddingformutli">
  82. Description:&nbsp;&nbsp;
  83. </td>
  84. <td class="descriptionmoveinmulti">
  85. #description#
  86. ( You may enter up to 1000 characters. )
  87. <br>
  88. <textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name="thedescription_#count#"></textarea>
  89. </td>
  90. </tr>
  91. </table>
  92.  
  93. <!---Shows what was previously entered for Resolution  --->
  94.  
  95. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  96. <tr>
  97. <td id="paddingformutli">
  98. Resolution:&nbsp;&nbsp;
  99. </td>
  100. <td class="resolutionmoveinmulti">
  101. ( You may enter up to 1500 characters. )
  102. <br>
  103. <textarea  maxlength="1500" onkeyup="return resolutionismaxlength(this)" onkeydown="return resolutionismaxlength(this)" rows="4" cols="60" name="resolution_#count#">#resolution#</textarea>
  104. </td>
  105. </tr>
  106. </table>
  107.  
  108. <!--- Shows what was previously entered for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by  --->
  109.  
  110. <table class="zpExpandedTable" id="resoldatetab" cellpadding="1" cellspacing="0">
  111. <tr>
  112. <td id="paddingformultitop">
  113. Resolution Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
  114. </td>
  115. <td>
  116. <input type="text" name="resdate_#count#" value="#DateFormat(resolution_date,'mm/dd/yyyy')#">&nbsp;&nbsp;
  117. &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
  118. <input type="checkbox" name="currentdateresol_#count#" 
  119. onClick="resdate_#count#.value=fill_date()">
  120. </td>
  121. <td>
  122. Resolution Verified as effective by:&nbsp;&nbsp;
  123. </td>
  124. <td>
  125. <select name="resvertified_#count#">
  126. <option value="" selected>Make A Selection</option>
  127. <cfloop query="gettech">
  128. <option value="#fname# #lname#"<cfif "#fname# #lname#" is #resolution_verified_by#>
  129. selected</cfif>>#fname# #lname#</option>
  130. </cfloop>
  131. </select>
  132. </td>
  133. </tr>
  134. </table>
  135. <!--- Shows what was previously entered for Vertification Date, Current Date (for vertification date)   --->
  136. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  137. <tr>
  138. <td id="paddingformultitop">
  139. Verification Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
  140. </td>
  141. <td class="vertificationmoveinmulti">
  142. <input type="text" name="vertifidate_#count#" value="#DateFormat(verification_date,'mm/dd/yyyy')#">&nbsp;&nbsp;
  143. &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
  144. <input type="checkbox" name="currentdatevert_#count#" 
  145. onClick="vertifidate_#count#.value=fill_date()">
  146. </td>
  147. </tr>
  148. </table>
  149.  
  150. <!--- Shows what was previously entered for Dept/Vendor Responsibility  --->
  151. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  152. <tr>
  153. <td class="red" id="paddingformultitop">
  154. Dept/Vendor Responsibility*:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  155. <select name="deptvendor_#count#">
  156. <option value="" selected>Make A Selection</option>
  157. <cfloop query="getDeptVendor">
  158. <option value="#pk_deptVendor#"<cfif #pk_deptVendor# is #dept_responsibility#>selected</cfif>>#pk_deptVendor#</option>
  159. </cfloop>
  160. </select>
  161. </td>
  162. </tr>
  163. </table>
  164.  
  165. <input type="hidden" name="serialcount" id="serialcount" value="#count#">
  166. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count#">
  167. <input type="hidden" name="part2count#count#" id="part2count#count#" value="">
  168. <!--- Adds Delete to every ticket  --->
  169. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  170. <tr>
  171. <td>
  172. <input type="button" class="removeticket" value="Remove Serial #count#" onclick="removeElement('dynamic#count#Input')">
  173. </td>
  174. </tr>
  175. <tr>
  176. <td>
  177. <input type="button" class="addticket" value="Add Parts" onclick=
  178. "addpartInput('dynamic#count#Input')">
  179. </td>
  180. </tr>
  181. </table>
  182.  
  183.  
  184. <!---Shows what was previously entered into parts table--->
  185. <!---dbtype="query"--->
  186. <cfquery name="getparts" dbtype="query" >
  187. SELECT *
  188. FROM parts
  189. WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
  190. cfsqltype="cf_sql_char" maxLength="20">
  191. </cfquery>
  192. <cfset count1 = 0>
  193. <!---<cfif serial.recordcount is 0>--->
  194. <cfloop query="getparts">
  195. <cfset count1 = count1 + 1>
  196. <div id="part#count1#Name#count#">
  197. <!---THIS IS THE PARTS SECTION--->
  198. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  199. <th class="sectiontitle" colspan="7">Parts Information #count1# Serial Information #count#</th>
  200. <tr>
  201. <td class='indent' id='formfieldpadding'>HC P/N:&nbsp;&nbsp;&nbsp;<input type='text' name="hcpn_#count1#_#count#" style="margin:0px" value="#hc_partNo#"></td>
  202. <td>
  203. Parts been returned*
  204. <input type="checkbox" name="partsreturn_#count1#_#count#" value="#part_returned#"<cfif #part_returned# eq "1">checked=yes</cfif>/>
  205. </td>
  206. <td>
  207. <td class="indent">Defective<input type="checkbox" name="defective_#count1#_#count#" value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/></td>
  208. </td>
  209. </tr>
  210. </table>
  211. <!---<input type="hidden" name="partscount#count#" id="partscount#count#" value="#count#">--->
  212.  
  213.  
  214. <!--- Shows what was previously entered for RMA Data Only  --->
  215. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  216. <tr>
  217. <td id="paddingformultitop">
  218. RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;
  219. </td>
  220. <td class="rmanmoveinmulti">
  221. ( You may enter up to 1000 characters. )
  222. <br/>
  223. <textarea maxlength="1000" onkeyup="return rmaismaxlength(this)" onkeydown="return rmaismaxlength(this)" rows="4" cols="60" name="rma_#count1#_#count#" >#rma_number#</textarea>
  224. </td>
  225. </tr>
  226. </table>
  227.  
  228.  
  229. <!--- Adds Delete to every ticket  --->
  230. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  231. <tr>
  232. <td>
  233. <input type="button" class="removeticket" value="Remove Parts #count1#" 
  234. onclick="removetheElement('part#count1#Name#count#',#count#,#count#)"></a>
  235. </td>
  236. </td>
  237. </tr>
  238. </table>
  239. </div>
  240. </cfloop>
  241. </div> 
  242. </cfoutput>
  243. <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
  244.  
  245. <!---
  246. <!---If have any blanks in serial table it will make field appear--->
  247. <cfoutput query="serial">
  248. <cfset model_no = #model_no#>
  249. <cfset product_type = #product_type#>
  250. <cfset type_hardware_failure = #type_hardware_failure#>
  251. <cfset pka_serialNo = #pka_serialNo#>
  252. <cfset software_hardware = #software_hardware#>
  253. <cfset description = #description#>
  254. <cfset resolution = #resolution#>
  255. <cfset resolution_date = #resolution_date#>
  256. <cfset resolution_verified_by = #resolution_verified_by#>
  257. <cfset verification_date = #verification_date#>
  258. <cfset dept_responsibility = #dept_responsibility#>
  259. </cfoutput>
  260. <cfif serial.recordcount is 0>
  261. <cfset model_no = "">
  262. <cfset product_type = "">
  263. <cfset type_hardware_failure = "">
  264. <cfset pka_serialNo = "">
  265. <cfset software_hardware = "">
  266. <cfset description = "">
  267. <cfset resolution = "">
  268. <cfset resolution_date = "">
  269. <cfset resolution_verified_by = "">
  270. <cfset verification_date = "">
  271. <cfset dept_responsibility = "">
  272. <cfinclude template="serialdisplay.cfm">
  273. </cfif>
  274.  
  275. <!---Parts Information, display parts if have or don't have a value--->
  276. <cfoutput query="parts">
  277. <cfset hc_partNo = #hc_partNo#>
  278. <cfset part_returned = #part_returned#>
  279. <cfset defective = #defective#>
  280. <cfset rma_number = #rma_number#>
  281. <cfinclude template="partsdisplay.cfm">
  282. </cfoutput>
  283. <cfif parts.recordcount is 0>
  284. <cfset hc_partNo = "">
  285. <cfset part_returned = "">
  286. <cfset defective = "">
  287. <cfset rma_number = "">
  288. <cfinclude template="partsdisplay.cfm">
  289. </cfif>
  290. --->
  291. </div>
  292.      <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
  293.  
  294.  
right now i have the serialdisplay.cfm and partsdisplay.cfm in comments because its causeing me problems as well, but its suppose to display fields if no one entered a value for it. which if you need the information for both of those let me know.

Thank you,
Rach
Oct 26 '08 #112
acoder
16,027 Expert Mod 8TB
Don't forget that you will need to update the code for the recent change, i.e. when displaying previously entered fields, the part numbers need to be up to date. So on line 167 where part2count#count# is set, the value should not be "". It should be filled with a list of the parts - 1 to the #count# value.
Oct 27 '08 #113
bonneylake
769 512MB
Don't forget that you will need to update the code for the recent change, i.e. when displaying previously entered fields, the part numbers need to be up to date. So on line 167 where part2count#count# is set, the value should not be "". It should be filled with a list of the parts - 1 to the #count# value.
Hey Acoder,

alrighty i changed that line to

Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="part2count#count#" id="part2count#count#" value="#count#">
whats next? because i am still having the problem that once i go an edit a field and submit it an go to view the results again instead of just showing the one i change it ends up showing it multiple times. An i have checked the tables for both serial and parts an its not repeating the serial or parts. Any ideas?

Thank you,
Rach
Oct 27 '08 #114
acoder
16,027 Expert Mod 8TB
The change that you've made wouldn't be enough because if, for example, you had three parts, it should be "1,2,3,", so you need a cfloop to construct the list.

Can you post the update field page code containing the form which you use to update/edit fields and the update serial/parts page including the query(ies).
Oct 27 '08 #115
bonneylake
769 512MB
The change that you've made wouldn't be enough because if, for example, you had three parts, it should be "1,2,3,", so you need a cfloop to construct the list.

Can you post the update field page code containing the form which you use to update/edit fields and the update serial/parts page including the query(ies).
Hey Acoder,

Here is the queries i am using

Expand|Select|Wrap|Line Numbers
  1. <!---Shows what was previously entered into serial and description table--->
  2. <cfquery name="serial" datasource="CustomerSupport">
  3.         SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware,
  4.        resolution,resolution_date,verification_date,type_hardware_failure,
  5.         dept_responsibility,resolution_verified_by,fk_serialNo,fk_ticketNo,description
  6.         FROM dbo.tbl_CS_serial
  7.         LEFT JOIN dbo.tbl_CS_notes_descr
  8.         ON dbo.tbl_CS_serial.pkb_fk_ticketNo=dbo.tbl_CS_notes_descr.fk_ticketNo and
  9.         dbo.tbl_CS_serial.pka_serialNo=dbo.tbl_CS_notes_descr.fk_serialNo
  10.         WHERE pkb_fk_ticketNo = #URL.pk_ticketID# and fk_ticketNo = #URL.pk_ticketID#
  11.         ORDER BY pkb_fk_ticketNo
  12. </cfquery>
  13.  
  14. <!---Shows what was previously entered into parts table--->
  15. <cfquery name="parts" datasource="CustomerSupport">
  16.        SELECT pk_partID,fk_serialNo,fk_ticketNo,hc_partNo,ltrim(rtrim(part_returned)) as        part_returned,rma_number,defective
  17.          FROM dbo.tbl_CS_parts
  18.          WHERE fk_ticketNo = #URL.pk_ticketID#
  19. </cfquery>
and here is what i am using to update/edit

Expand|Select|Wrap|Line Numbers
  1. <form action="userformedit.cfm" id="userForm"  name="userForm" method="POST" enctype="multipart/form-data" onclick="multipleSelectOnSubmit();">
  2.  
  3. <!--- Ticket Information 
  4.        This display the ticket Information--->
  5.  
  6. <!---<input type="hidden" value="0" id="theValue" />--->
  7.     <div id="dynamicInput"> 
  8.      <!--- All Ticket Information Appears Here--->
  9.   <!--- Shows what was previously entered for Model No, Product Type, and Type of Hardware Failure  --->
  10. <cfset count = 0>
  11. <!---<cfif serial.recordcount is 0>--->
  12. <cfoutput query="serial">
  13. <cfset model_no = #model_no#>
  14. <cfset product_type = #product_type#>
  15. <cfset type_hardware_failure = #type_hardware_failure#>
  16. <cfset software_hardware = #software_hardware#>
  17. <cfset resolution_verified_by = #resolution_verified_by#>
  18. <cfset dept_responsibility = #dept_responsibility#>
  19. <cfset count = count + 1>
  20. <div id="dynamic#count#Input"> 
  21. <table class="zpExpandedTable" id="modeltable"> 
  22. <th class="sectiontitletick" colspan="7">
  23. Serial Information #count# </th>
  24. <tr>
  25. <td id="paddingformultitop">Model No:&nbsp;&nbsp;&nbsp;&nbsp;</td>
  26. </td>
  27. <td>
  28. <select name="modelno_#count#">
  29. <option value="">Make A Selection</option>
  30. <cfloop query="models">
  31. <option value="#model#"<cfif #model# is #model_no#>selected</cfif>>#model#</option>
  32. </cfloop> 
  33. </select>
  34. </td>
  35. <td>
  36. &nbsp;&nbsp;&nbsp;&nbsp;Product Type:
  37. </td>
  38. <td>
  39. <select name="producttype_#count#">
  40. <option value="" selected>No Choice</option>
  41. <cfloop query="getProdType">
  42. <option value="#pk_productType#"<cfif #pk_productType# is #product_type#>selected</cfif>>#pk_productType#</option> 
  43. </cfloop>
  44. </select>
  45. </td>
  46. <td class="red">
  47. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type Of Hardware Failure*:
  48. </td>
  49. <td>
  50. <select name="hardwarefailure_#count#">
  51. <option value="" selected>Make A Selection</option>
  52. <cfloop query="getHardwareFail">
  53. <option value="#pk_hardwareFailure#"<cfif #pk_hardwareFailure# is #type_hardware_failure#>selected</cfif>>#pk_hardwareFailure#</option>
  54. </cfloop>
  55. </select>
  56. </td>
  57. </tr>
  58. <table>
  59.  
  60. <!--- Shows what was previously entered for Serial Number and Software/Hardware  --->
  61. <table class="zpExpandedTable" id="modeltable">
  62. <tr>
  63. <td id="paddingformultitop">
  64. Serial Number:&nbsp;&nbsp;
  65. <input type="text" name="serialnum_#count#" value="#pka_serialNo#">
  66. &nbsp;&nbsp;&nbsp;&nbsp;Software/Hardware:&nbsp;&nbsp;
  67. <select name="softhardware_#count#">
  68. <option value="" selected>No Choice</option>
  69. <cfloop query="getSoftHard">
  70. <option value="#pk_softwareHardware#"<cfif #pk_softwareHardware# is #software_hardware#>selected</cfif>>#pk_softwareHardware#</option>
  71. </cfloop>
  72. </select>
  73. </td>
  74. </tr>
  75. </table>
  76.  
  77. <!--- Shows what was previously entered for Description ---> 
  78.  
  79. <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
  80. <tr>
  81. <td id="paddingformutli">
  82. Description:&nbsp;&nbsp;
  83. </td>
  84. <td class="descriptionmoveinmulti">
  85. #description#
  86. ( You may enter up to 1000 characters. )
  87. <br>
  88. <textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name="thedescription_#count#"></textarea>
  89. </td>
  90. </tr>
  91. </table>
  92.  
  93. <!---Shows what was previously entered for Resolution  --->
  94.  
  95. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  96. <tr>
  97. <td id="paddingformutli">
  98. Resolution:&nbsp;&nbsp;
  99. </td>
  100. <td class="resolutionmoveinmulti">
  101. ( You may enter up to 1500 characters. )
  102. <br>
  103. <textarea  maxlength="1500" onkeyup="return resolutionismaxlength(this)" onkeydown="return resolutionismaxlength(this)" rows="4" cols="60" name="resolution_#count#">#resolution#</textarea>
  104. </td>
  105. </tr>
  106. </table>
  107.  
  108. <!--- Shows what was previously entered for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by  --->
  109.  
  110. <table class="zpExpandedTable" id="resoldatetab" cellpadding="1" cellspacing="0">
  111. <tr>
  112. <td id="paddingformultitop">
  113. Resolution Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
  114. </td>
  115. <td>
  116. <input type="text" name="resdate_#count#" value="#DateFormat(resolution_date,'mm/dd/yyyy')#">&nbsp;&nbsp;
  117. &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
  118. <input type="checkbox" name="currentdateresol_#count#" 
  119. onClick="resdate_#count#.value=fill_date()">
  120. </td>
  121. <td>
  122. Resolution Verified as effective by:&nbsp;&nbsp;
  123. </td>
  124. <td>
  125. <select name="resvertified_#count#">
  126. <option value="" selected>Make A Selection</option>
  127. <cfloop query="gettech">
  128. <option value="#fname# #lname#"<cfif "#fname# #lname#" is #resolution_verified_by#>
  129. selected</cfif>>#fname# #lname#</option>
  130. </cfloop>
  131. </select>
  132. </td>
  133. </tr>
  134. </table>
  135. <!--- Shows what was previously entered for Vertification Date, Current Date (for vertification date)   --->
  136. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  137. <tr>
  138. <td id="paddingformultitop">
  139. Verification Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
  140. </td>
  141. <td class="vertificationmoveinmulti">
  142. <input type="text" name="vertifidate_#count#" value="#DateFormat(verification_date,'mm/dd/yyyy')#">&nbsp;&nbsp;
  143. &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
  144. <input type="checkbox" name="currentdatevert_#count#" 
  145. onClick="vertifidate_#count#.value=fill_date()">
  146. </td>
  147. </tr>
  148. </table>
  149.  
  150. <!--- Shows what was previously entered for Dept/Vendor Responsibility  --->
  151. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  152. <tr>
  153. <td class="red" id="paddingformultitop">
  154. Dept/Vendor Responsibility*:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  155. <select name="deptvendor_#count#">
  156. <option value="" selected>Make A Selection</option>
  157. <cfloop query="getDeptVendor">
  158. <option value="#pk_deptVendor#"<cfif #pk_deptVendor# is #dept_responsibility#>selected</cfif>>#pk_deptVendor#</option>
  159. </cfloop>
  160. </select>
  161. </td>
  162. </tr>
  163. </table>
  164.  
  165. <input type="hidden" name="serialcount" id="serialcount" value="#count#">
  166. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count#">
  167. <input type="hidden" name="part2count#count#" id="part2count#count#" value="#count#">
  168. <!--- Adds Delete to every ticket  --->
  169. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  170. <tr>
  171. <td>
  172. <input type="button" class="removeticket" value="Remove Serial #count#" onclick="removeElement('dynamic#count#Input')">
  173. </td>
  174. </tr>
  175. <tr>
  176. <td>
  177. <input type="button" class="addticket" value="Add Parts" onclick=
  178. "addpartInput('dynamic#count#Input')">
  179. </td>
  180. </tr>
  181. </table>
  182.  
  183.  
  184. <!---Shows what was previously entered into parts table--->
  185. <!---dbtype="query"--->
  186. <cfquery name="getparts" dbtype="query" >
  187. SELECT *
  188. FROM parts
  189. WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
  190. cfsqltype="cf_sql_char" maxLength="20">
  191. </cfquery>
  192. <cfset count1 = 0>
  193. <!---<cfif serial.recordcount is 0>--->
  194. <cfloop query="getparts">
  195. <cfset count1 = count1 + 1>
  196. <div id="part#count1#Name#count#">
  197. <!---THIS IS THE PARTS SECTION--->
  198. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  199. <th class="sectiontitle" colspan="7">Parts Information #count1# Serial Information #count#</th>
  200. <tr>
  201. <td class='indent' id='formfieldpadding'>HC P/N:&nbsp;&nbsp;&nbsp;<input type='text' name="hcpn_#count1#_#count#" style="margin:0px" value="#hc_partNo#"></td>
  202. <td>
  203. Parts been returned*
  204. <input type="checkbox" name="partsreturn_#count1#_#count#" value="#part_returned#"<cfif #part_returned# eq "1">checked=yes</cfif>/>
  205. </td>
  206. <td>
  207. <td class="indent">Defective<input type="checkbox" name="defective_#count1#_#count#" value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/></td>
  208. </td>
  209. </tr>
  210. </table>
  211. <!---<input type="hidden" name="partscount#count#" id="partscount#count#" value="#count#">--->
  212.  
  213.  
  214. <!--- Shows what was previously entered for RMA Data Only  --->
  215. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  216. <tr>
  217. <td id="paddingformultitop">
  218. RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;
  219. </td>
  220. <td class="rmanmoveinmulti">
  221. ( You may enter up to 1000 characters. )
  222. <br/>
  223. <textarea maxlength="1000" onkeyup="return rmaismaxlength(this)" onkeydown="return rmaismaxlength(this)" rows="4" cols="60" name="rma_#count1#_#count#" >#rma_number#</textarea>
  224. </td>
  225. </tr>
  226. </table>
  227.  
  228.  
  229. <!--- Adds Delete to every ticket  --->
  230. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  231. <tr>
  232. <td>
  233. <input type="button" class="removeticket" value="Remove Parts #count1#" 
  234. onclick="removetheElement('part#count1#Name#count#',#count#,#count#)"></a>
  235. </td>
  236. </td>
  237. </tr>
  238. </table>
  239. </div>
  240. </cfloop>
  241. </div> 
  242. </cfoutput>
  243. <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
  244.  
  245.  
  246. <!---If have any blanks in serial table it will make field appear--->
  247. <cfoutput query="serial">
  248. <cfset model_no = #model_no#>
  249. <cfset product_type = #product_type#>
  250. <cfset type_hardware_failure = #type_hardware_failure#>
  251. <cfset pka_serialNo = #pka_serialNo#>
  252. <cfset software_hardware = #software_hardware#>
  253. <cfset description = #description#>
  254. <cfset resolution = #resolution#>
  255. <cfset resolution_date = #resolution_date#>
  256. <cfset resolution_verified_by = #resolution_verified_by#>
  257. <cfset verification_date = #verification_date#>
  258. <cfset dept_responsibility = #dept_responsibility#>
  259. </cfoutput>
  260. <cfif serial.recordcount is 0>
  261. <cfset model_no = "">
  262. <cfset product_type = "">
  263. <cfset type_hardware_failure = "">
  264. <cfset pka_serialNo = "">
  265. <cfset software_hardware = "">
  266. <cfset description = "">
  267. <cfset resolution = "">
  268. <cfset resolution_date = "">
  269. <cfset resolution_verified_by = "">
  270. <cfset verification_date = "">
  271. <cfset dept_responsibility = "">
  272. <cfinclude template="serialdisplay.cfm">
  273. </cfif>
  274.  
  275. <!---Parts Information, display parts if have or don't have a value--->
  276. <cfoutput query="parts">
  277. <cfset hc_partNo = #hc_partNo#>
  278. <cfset part_returned = #part_returned#>
  279. <cfset defective = #defective#>
  280. <cfset rma_number = #rma_number#>
  281. <cfinclude template="partsdisplay.cfm">
  282. </cfoutput>
  283. <cfif parts.recordcount is 0>
  284. <cfset hc_partNo = "">
  285. <cfset part_returned = "">
  286. <cfset defective = "">
  287. <cfset rma_number = "">
  288. <cfinclude template="partsdisplay.cfm">
  289. </cfif>
  290.  
  291. </div>
  292.      <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
  293.  
  294. <!--- Submit --->
  295. <table>
  296. <tr>
  297. <td>
  298. <input type="submit" class="officalsubmit" value="submit" name="submit" onClick="return validate_form();">
  299. </td>
  300. </tr>
  301. </table>
  302. </form>
and where do i need the cfloop list at?

Thank you,
Rach
Oct 27 '08 #116
acoder
16,027 Expert Mod 8TB
I see. Can you post the code for userformedit.cfm?

Add the cfloop before the input field line. It should create a string starting from 1 to #count#.
Oct 27 '08 #117
bonneylake
769 512MB
I see. Can you post the code for userformedit.cfm?

Add the cfloop before the input field line. It should create a string starting from 1 to #count#.
Hey Acoder,

Here is what is on the userformedit.cfm page

Expand|Select|Wrap|Line Numbers
  1. <!---Inserts information into serial table.--->
  2. <CFIF REQUEST_METHOD EQ "POST">
  3. <CFSET machineListLen = listLen(Form.serialcount)>
  4. <CFLOOP from="1" to="#machineListLen#" index="machineCount">
  5.  <CFSET serialnum       = Form["serialnum_" & machineCount]>
  6.  <CFSET modelno         = Form["modelno_" & machineCount]>
  7.  <CFSET producttype     = Form["producttype_" & machineCount]>
  8.  <CFSET softhardware    = Form["softhardware_" & machineCount]>
  9.  <CFSET resolution      = Form["resolution_" & machineCount]>
  10.  <CFSET resdate         = Form["resdate_" & machineCount]>
  11.  <CFSET resvertified    = Form["resvertified_" & machineCount]>
  12.  <CFSET vertifidate     = Form["vertifidate_" & machineCount]>
  13.  <CFSET deptvendor      = Form["deptvendor_" & machinecount]>
  14.  <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
  15. <CFSET thedescription  = Form["thedescription_" & machineCount]>
  16.  
  17.  
  18. <!--- inserts information into the serial table--->
  19. <cfquery name="serialinsertupdate" datasource="CustomerSupport">
  20.    exec usp_CS_UpdateInsertserial 
  21.      <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  22.      "#Form.pk_ticketID#",
  23.      <cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
  24.      <cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
  25.      <cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
  26.      <cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
  27.      <cfqueryparam value="#resdate#">,
  28.      <cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
  29.      <cfqueryparam value="#vertifidate#">,
  30.      <cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
  31.      <cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">   
  32.      </cfquery>
  33.  
  34.  
  35.  
  36. <!---Inserts information into notes_descr table.--->
  37. <cfquery name="description" datasource="CustomerSupport">
  38.     exec usp_CS_Insertdescription
  39.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  40.    '#Form.pk_ticketID#',
  41.    <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
  42.    '#Form.fk_addedBy#'
  43. </cfquery>
  44.  
  45.  
  46.  
  47.  
  48. <!---Inserts parts information into parts table.--->
  49. <!---because it is a bit we don't use 'ticks' around defective for parts table--->
  50. <cfloop list="#form['part2count' & machinecount]#" index="ps">
  51. <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
  52. <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
  53. <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
  54. <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
  55. <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
  56. <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
  57. <cfquery name="parts" datasource="CustomerSupport">
  58.     exec usp_CS_Updateparts 
  59.     <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  60.     '#Form.pk_ticketID#',
  61.     <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
  62.     <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
  63.     <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">,
  64.     <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">
  65. </cfquery>
  66. </cfloop>
an would this be correct for the cfloop. i have it in the update part of the form.

Expand|Select|Wrap|Line Numbers
  1. <cfloop from="1" to="#count#" index="counttheparts">
  2. <input type="hidden" name="part2count#count#" id="part2count#count#" value="#count#">
  3. </cfloop>
an i noticed another problem with the insert :(, you know how we created another count for parts? well i need to do the same thing for serial because if you skip one serial it has a similar fit as parts did.


Thank you,
Rach
Oct 27 '08 #118
acoder
16,027 Expert Mod 8TB
Yes, you'll need to update the input field named serialcount too.

For the cfloop, create a string using cfset and then set value to this string in place of #count#:
Expand|Select|Wrap|Line Numbers
  1. <cfset partliststr = "">
  2. <cfloop ...>
  3. <cfset partliststr = partliststr & ...>
  4. </cfloop>
  5. <input ...>
From your update page code, it seems that you might have to make a few alterations, but let's get this part working first.
Oct 27 '08 #119
bonneylake
769 512MB
Yes, you'll need to update the input field named serialcount too.

For the cfloop, create a string using cfset and then set value to this string in place of #count#:
Expand|Select|Wrap|Line Numbers
  1. <cfset partliststr = "">
  2. <cfloop ...>
  3. <cfset partliststr = partliststr & ...>
  4. </cfloop>
  5. <input ...>
From your update page code, it seems that you might have to make a few alterations, but let's get this part working first.
Hey Acoder,

would something like this be correct?

Expand|Select|Wrap|Line Numbers
  1. <cfset partliststr = "pl">
  2. <cfloop from="1" to="#count#" index="pl">
  3. <cfset partliststr = partliststr & #pl#>
  4. </cfloop>
  5. <input type="hidden" name="part2count#count#" id="part2count#count#" value="#count#">
an i started working on the serial part an making a seperate count for it, well atleast tempting to. So far in the serial function i added (i have it commented out so it wont affect anything). but i added

Expand|Select|Wrap|Line Numbers
  1. var serialc = 'sc'+count;
an then i added a hidden field of

Expand|Select|Wrap|Line Numbers
  1. "<input type='hidden' name='"+serialc+"' id='"+serialc+"' value=''>" +
an well i added only this to the delete of the serial function but i got confused when i got to delete

Expand|Select|Wrap|Line Numbers
  1. var getserial = document.getElementByID('serialc');
Thank you,
Rach
Oct 27 '08 #120
acoder
16,027 Expert Mod 8TB
partliststr would have to be empty to begin with and you need to add a comma after each number and finally you need to set the value:
Expand|Select|Wrap|Line Numbers
  1. <cfset partliststr = "">
  2. <cfloop from="1" to="#count#" index="pl">
  3. <cfset partliststr = partliststr & #pl# & ",">
  4. </cfloop>
  5. <input type="hidden" name="part2count#count#" id="part2count#count#" value="#partliststr#">
You also need to do something similar for serialcount - not create a new field.
Oct 27 '08 #121
bonneylake
769 512MB
partliststr would have to be empty to begin with and you need to add a comma after each number and finally you need to set the value:
Expand|Select|Wrap|Line Numbers
  1. <cfset partliststr = "">
  2. <cfloop from="1" to="#count#" index="pl">
  3. <cfset partliststr = partliststr & #pl# & ",">
  4. </cfloop>
  5. <input type="hidden" name="part2count#count#" id="part2count#count#" value="#partliststr#">
You also need to do something similar for serialcount - not create a new field.
Hey Acoder,

Here is what i created for both the part an serial

Expand|Select|Wrap|Line Numbers
  1. <cfset serialstr = "">
  2. <cfloop from="1" to="#count#" index="sl">
  3. <cfset serialstr = serialstr & #sl# & ",">
  4. </cfloop>
  5. <input type="hidden" name="serialcount" id="serialcount" value="#serialstr#">
  6. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count#">
  7. <cfset partliststr = "">
  8. <cfloop from="1" to="#count#" index="pl">
  9. <cfset partliststr = partliststr & #pl# & ",">
  10. </cfloop>
  11. <input type="hidden" name="part2count#count#" id="part2count#count#" value="#partliststr#">
an the example i was showing above with the serialcount was for the insert because running into the same problem that i had with parts with the serial.where if i had serials 1,2, and 3 an delete 2 it has an issue with it. Would what i have in the post before this one would for that?

Thank you,
Rach
Oct 27 '08 #122
acoder
16,027 Expert Mod 8TB
Move the code for serialcount to wherever it appears in the code. It shouldn't appear in the code for addInput. It should be in the HTML code. Find it there and that's where you'd put the cfloop for serialstr.
Oct 27 '08 #123
bonneylake
769 512MB
Move the code for serialcount to wherever it appears in the code. It shouldn't appear in the code for addInput. It should be in the HTML code. Find it there and that's where you'd put the cfloop for serialstr.
Hey Acoder,

It is in the html its not in the addinput at all.

this is what i have in the addinput
Expand|Select|Wrap|Line Numbers
  1. "<input type='hidden' name='"+partc+"' id='"+partc+"' value='0'>" +
  2. "<input type='hidden' name='"+part2c+"' id='"+part2c+"' value=''>" +
  3. "<input type='hidden' name='serialcount' id='serialcount' value='" + count + "'>";

this is what i have in the html
Expand|Select|Wrap|Line Numbers
  1. <cfset serialstr = "">
  2. <cfloop from="1" to="#count#" index="sl">
  3. <cfset serialstr = serialstr & #sl# & ",">
  4. </cfloop>
  5. <input type="hidden" name="serialcount" id="serialcount" value="#serialstr#">
  6. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count#">
  7. <cfset partliststr = "">
  8. <cfloop from="1" to="#count#" index="pl">
  9. <cfset partliststr = partliststr & #pl# & ",">
  10. </cfloop>
  11. <input type="hidden" name="part2count#count#" id="part2count#count#" value="#partliststr#">
  12. <!--- Adds Delete to every ticket  --->
  13. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  14. <tr>
  15. <td>
Thank you,
Rach
Oct 27 '08 #124
acoder
16,027 Expert Mod 8TB
Now that I look at this again, you can get rid of what you've added for serialstr. serialcount is a series of input fields, so what you need to do is make sure each serialcount applies to a serial, i.e. the first one should be set to "1", the second "2", etc. Check that in the source code.

For the parts, you need to use the correct count, so you can't use #count# which would probably be the serial count. You'll need to make sure it's the parts count being used. Make sure everything is set right by testing with a number of scenarios, e.g. 1 serial, 1 part, 2 serials, 1 part or 2 parts or a mixture and see if all the values are set correctly.
Oct 27 '08 #125
bonneylake
769 512MB
Now that I look at this again, you can get rid of what you've added for serialstr. serialcount is a series of input fields, so what you need to do is make sure each serialcount applies to a serial, i.e. the first one should be set to "1", the second "2", etc. Check that in the source code.

For the parts, you need to use the correct count, so you can't use #count# which would probably be the serial count. You'll need to make sure it's the parts count being used. Make sure everything is set right by testing with a number of scenarios, e.g. 1 serial, 1 part, 2 serials, 1 part or 2 parts or a mixture and see if all the values are set correctly.
Hey Acoder,

Only thing i am confused on is this.
Does partscount and partcount2 need to appear in the parts section of the html?

right now these appear in the serial section of the html
Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="serialcount" id="serialcount" value="#count#">
  2.  
and this one in parts

Expand|Select|Wrap|Line Numbers
  1. <cfset partliststr = "">
  2. <cfloop from="1" to="#count1#" index="pl">
  3. <cfset partliststr = partliststr & #pl# & ",">
  4. </cfloop>
  5. <input type="hidden" name="part2count#count1#" id="part2count#count1#" value="#partliststr#">
  6. <input type="hidden" name="partscount#count#" id="partscount#count1#" value="#count1#">
but i think i might have an idea of whats causing it.i took out serial count an i got errors, but it didn't insert multiple. However, when i took out the 2 different parts count an left t he serialcount it added serials. So i think it has to do with this
Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="serialcount" id="serialcount" value="#count#">.
i don't know if it makes a difference but i have serialcount in the addinput as well (except written in javascript), could that be causing it?


Thank you,
Rach
Oct 27 '08 #126
acoder
16,027 Expert Mod 8TB
Does partscount and partcount2 need to appear in the parts section of the html?
No it doesn't because these are the parts counts/lists for that particular serial, so it'd only make sense for it to appear once for each serial.

The parts count fields should be named using #count# (serial), but the value should be set to #count1# (part):
Expand|Select|Wrap|Line Numbers
  1. <cfset partliststr = "">
  2. <cfloop from="1" to="#count1#" index="pl">
  3. <cfset partliststr = partliststr & #pl# & ",">
  4. </cfloop>
  5. <input type="hidden" name="part2count#count#" id="part2count#count#" value="#partliststr#">
  6. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#">
but i think i might have an idea of whats causing it.i took out serial count an i got errors, but it didn't insert multiple. However, when i took out the 2 different parts count an left t he serialcount it added serials.
That might've been caused by the incorrect naming.

On the issue of the serial count being added multiple times, that is correct because it's passed as a list to Coldfusion. See the passed value to see what I mean. In fact, this might have been a good way of dealing with the parts count/list instead of what was done in this thread.
Oct 28 '08 #127
bonneylake
769 512MB
No it doesn't because these are the parts counts/lists for that particular serial, so it'd only make sense for it to appear once for each serial.

The parts count fields should be named using #count# (serial), but the value should be set to #count1# (part):
Expand|Select|Wrap|Line Numbers
  1. <cfset partliststr = "">
  2. <cfloop from="1" to="#count1#" index="pl">
  3. <cfset partliststr = partliststr & #pl# & ",">
  4. </cfloop>
  5. <input type="hidden" name="part2count#count#" id="part2count#count#" value="#partliststr#">
  6. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#">
That might've been caused by the incorrect naming.

On the issue of the serial count being added multiple times, that is correct because it's passed as a list to Coldfusion. See the passed value to see what I mean. In fact, this might have been a good way of dealing with the parts count/list instead of what was done in this thread.
Hey Acoder,

I made the changes to the parts. but in the html does it need to be under the parts section or under the serial section? Here is where i have it right now.
Expand|Select|Wrap|Line Numbers
  1. <!---Shows what was previously entered into parts table--->
  2. <!---dbtype="query"--->
  3. <cfquery name="getparts" dbtype="query" >
  4. SELECT *
  5. FROM parts
  6. WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
  7. cfsqltype="cf_sql_char" maxLength="20">
  8. </cfquery>
  9. <cfset count1 = 0>
  10. <!---<cfif serial.recordcount is 0>--->
  11. <cfloop query="getparts">
  12. <cfset count1 = count1 + 1>
  13. <div id="part#count1#Name#count#">
  14. <cfset partliststr = "">
  15. <cfloop from="1" to="#count1#" index="pl">
  16. <cfset partliststr = partliststr & #pl# & ",">
  17. </cfloop>
  18.  
  19. <input type="hidden" name="part2count#count#" id="part2count#count#" value="#partliststr#">
  20. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#">
an when you talked about passed as a list. Do you mean when the user submits the form an it goes to userform?an the part where it says listlen in the serial? If thats the case, how could i change it or make it where that it will still submit multiple serials, but that when i update it will only update the one serial instead of adding serials?

Expand|Select|Wrap|Line Numbers
  1. <!---Inserts information into serial table.--->
  2. <CFIF REQUEST_METHOD EQ "POST">
  3. <CFSET machineListLen = listLen(Form.serialcount)>
  4. <CFLOOP from="1" to="#machineListLen#" index="machineCount">
  5.  <CFSET serialnum       = Form["serialnum_" & machineCount]>
  6.  <CFSET modelno         = Form["modelno_" & machineCount]>
  7.  <CFSET producttype     = Form["producttype_" & machineCount]>
  8.  <CFSET softhardware    = Form["softhardware_" & machineCount]>
  9.  <CFSET resolution      = Form["resolution_" & machineCount]>
  10.  <CFSET resdate         = Form["resdate_" & machineCount]>
  11.  <CFSET resvertified    = Form["resvertified_" & machineCount]>
  12.  <CFSET vertifidate     = Form["vertifidate_" & machineCount]>
  13.  <CFSET deptvendor      = Form["deptvendor_" & machinecount]>
  14.  <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
  15. <CFSET thedescription  = Form["thedescription_" & machineCount]>
  16.  
  17.  
  18. <!--- inserts information into the serial table--->
  19. <cfquery name="serialinsertupdate" datasource="CustomerSupport">
  20.    exec usp_CS_UpdateInsertserial 
  21.      <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  22.      "#Form.pk_ticketID#",
  23.      <cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
  24.      <cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
  25.      <cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
  26.      <cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
  27.      <cfqueryparam value="#resdate#">,
  28.      <cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
  29.      <cfqueryparam value="#vertifidate#">,
  30.      <cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
  31.      <cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">   
  32.      </cfquery>
  33.  
  34.  
  35.  
  36. <!---Inserts information into notes_descr table.--->
  37. <cfquery name="description" datasource="CustomerSupport">
  38.     exec usp_CS_Insertdescription
  39.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  40.    '#Form.pk_ticketID#',
  41.    <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
  42.    '#Form.fk_addedBy#'
  43. </cfquery>
  44.  
  45.  
  46.  
  47.  
  48. <!---Inserts parts information into parts table.--->
  49. <!---because it is a bit we don't use 'ticks' around defective for parts table--->
  50. <cfloop list="#form['part2count' & machinecount]#" index="ps">
  51. <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
  52. <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
  53. <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
  54. <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
  55. <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
  56. <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
  57. <cfquery name="parts" datasource="CustomerSupport">
  58.     exec usp_CS_Updateparts 
  59.     <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  60.     '#Form.pk_ticketID#',
  61.     <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
  62.     <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
  63.     <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">,
  64.     <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">
  65. </cfquery>
  66. </cfloop>
  67. </CFLOOP>
  68. </CFIF>
Thank you,
Rach
Oct 28 '08 #128
acoder
16,027 Expert Mod 8TB
It should be under serial as you currently have it.

As for the update page, do you want it to update only one serial at a time or multiple serials/parts all in one go? If it's the latter, you will need to keep it similar to what it is now, though we'd need to check what the update query does. If it's the former, i.e. one at a time, then don't display all at once, provide an edit link to display a particular serial or part and only update that one serial or part.
Oct 28 '08 #129
bonneylake
769 512MB
It should be under serial as you currently have it.

As for the update page, do you want it to update only one serial at a time or multiple serials/parts all in one go? If it's the latter, you will need to keep it similar to what it is now, though we'd need to check what the update query does. If it's the former, i.e. one at a time, then don't display all at once, provide an edit link to display a particular serial or part and only update that one serial or part.
Hey Acoder,

Well the tricky part is. it does need to update multiple serial/parts in one go. But it also has to be able to accept adding more serials/parts and update the other previously submitted serial/parts at the same time. i haven't had any trouble adding any so far (even with having previously submitted serials/parts updating at the same time). an it has not added multiple serial/parts when i do insert. Just when i update previously submitted serial/parts. Do you want me to copy the update query for serial and parts?

Thank you,
Rach
Oct 28 '08 #130
acoder
16,027 Expert Mod 8TB
This could get complicated. What if someone adds and deletes serials and parts? You'd be adding, updating and deleting all in one go without any information about what is new and what's changed, etc. I would suggest that you keep updates, adds and deletes all separate. It's more logical and would make things easier.

If, for some reason, you must have all in one go, you'll need to pass this info. to the submit page, e.g. the primary key for serials and parts to allow updates, an indication for deletion, an indication of addition, for both parts and serials. This can be solved, but you'd have to do it carefully.
Oct 28 '08 #131
bonneylake
769 512MB
Hey Acoder,

Well i was thinking about keeping it in all in one go. But it sounds like it would be easier and better if we separate them out, so lets separate them out :). I have an update an a insert for serial and parts. Just don't have a delete for either of them right now. But my stored procedures

insert for serial
Expand|Select|Wrap|Line Numbers
  1. set ANSI_NULLS ON
  2. set QUOTED_IDENTIFIER ON
  3. go
  4.  
  5.  
  6. -- =============================================
  7. -- Author:        <Author,,Name>
  8. -- Create date: <Create Date,,>
  9. -- Description:    <Description,,>
  10. -- =============================================
  11. ALTER PROCEDURE [dbo].[usp_CS_Insertserial] 
  12.     -- Add the parameters for the stored procedure here
  13.        (@pka_serialNo nvarchar(100),
  14.        @pkb_fk_ticketNo nvarchar(100),
  15.        @model_no nvarchar(50),
  16.        @product_type nvarchar(100),
  17.        @software_hardware nvarchar(40),
  18.        @resolution nvarchar(500),
  19.        @resolution_date datetime,
  20.        @resolution_verified_by nvarchar(50),
  21.        @verification_date datetime,
  22.        @dept_responsibility nvarchar(50),
  23.        @type_hardware_failure nvarchar(100))
  24. AS
  25. BEGIN
  26.     -- SET NOCOUNT ON added to prevent extra result sets from
  27.     -- interfering with SELECT statements.
  28.     SET NOCOUNT ON;
  29.  
  30.     -- Insert statements for procedure here
  31.     insert into tbl_CS_serial
  32.     (pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware,resolution,resolution_date,
  33.      resolution_verified_by,verification_date,dept_responsibility,type_hardware_failure)
  34.  
  35.     values  
  36.     (@pka_serialNo,@pkb_fk_ticketNo,@model_no,@product_type,@software_hardware,@resolution,@resolution_date,
  37.      @resolution_verified_by,@verification_date,@dept_responsibility,@type_hardware_failure)            
  38.  
  39. END

update for serial

Expand|Select|Wrap|Line Numbers
  1. set ANSI_NULLS ON
  2. set QUOTED_IDENTIFIER ON
  3. go
  4.  
  5. -- =============================================
  6. -- Author:        <Author,,Name>
  7. -- Create date: <Create Date,,>
  8. -- Description:    <Description,,>
  9. -- =============================================
  10. ALTER PROCEDURE [dbo].[usp_CS_Updateserial]
  11.     -- Add the parameters for the stored procedure here
  12.     (@pka_serialNo nvarchar(100),
  13.     @pkb_fk_ticketNo nvarchar(100),
  14.     @model_no nvarchar(50),
  15.     @product_type nvarchar(100),
  16.     @software_hardware nvarchar(40),
  17.     @resolution nvarchar(500),
  18.     @resolution_date datetime,
  19.     @resolution_verified_by nvarchar(50),
  20.     @verification_date datetime,
  21.     @dept_responsibility nvarchar(50),
  22.     @type_hardware_failure nvarchar(100))
  23.  
  24. AS
  25.  
  26. UPDATE tbl_CS_serial
  27.  
  28. SET
  29.  
  30.     model_no=@model_no,
  31.     product_type=@product_type,
  32.     software_hardware=@software_hardware,
  33.     resolution=@resolution,
  34.     resolution_date=@resolution_date,
  35.     resolution_verified_by=@resolution_verified_by,
  36.     verification_date=@verification_date,
  37.     dept_responsibility=@dept_responsibility,
  38.     type_hardware_failure=@type_hardware_failure
  39.  
  40.  
  41.  
  42.  
  43. WHERE (pka_serialNo=@pka_serialNo and pkb_fk_ticketNo=@pkb_fk_ticketNo)
insert for parts
Expand|Select|Wrap|Line Numbers
  1. set ANSI_NULLS ON
  2. set QUOTED_IDENTIFIER ON
  3. go
  4.  
  5.  
  6. -- =============================================
  7. -- Author:        <Author,,Name>
  8. -- Create date: <Create Date,,>
  9. -- Description:    <Description,,>
  10. -- =============================================
  11. ALTER PROCEDURE [dbo].[usp_CS_Insertparts] 
  12.     -- Add the parameters for the stored procedure here
  13.     (@fk_serialNo nvarchar(100),
  14.     @fk_ticketNo nvarchar(100),
  15.     @hc_partNo nvarchar(50),
  16.     @part_returned char(10),
  17.     @defective bit,
  18.     @rma_number nvarchar(50))
  19. AS
  20. declare @pk_partID nvarchar(55)
  21. set @pk_partID = (select max_num from tbl_CS_ID_HELPER where table_name='tbl_CS_parts')
  22. update tbl_CS_ID_helper set max_num=max_num+1 where table_name='tbl_CS_parts'
  23. BEGIN
  24.     -- SET NOCOUNT ON added to prevent extra result sets from
  25.     -- interfering with SELECT statements.
  26.     SET NOCOUNT ON;
  27.  
  28.     -- Insert statements for procedure here
  29.     insert into tbl_CS_parts
  30.     (pk_partID,fk_serialNo,fk_ticketNo,hc_partNo,part_returned ,defective 
  31.      ,rma_number)
  32.  
  33.     values
  34.     (@pk_partID,@fk_serialNo,@fk_ticketNo,@hc_partNo,@part_returned,@defective 
  35.     ,@rma_number)
  36.  
  37. select @pk_partID as partID
  38. END
  39.  
an here is the parts update

Expand|Select|Wrap|Line Numbers
  1. set ANSI_NULLS ON
  2. set QUOTED_IDENTIFIER ON
  3. go
  4.  
  5. -- =============================================
  6. -- Author:        <Author,,Name>
  7. -- Create date: <Create Date,,>
  8. -- Description:    <Description,,>
  9. -- =============================================
  10. ALTER PROCEDURE [dbo].[usp_CS_Updateparts]
  11. -- Add the parameters for the stored procedure here
  12.     (@fk_serialNo nvarchar(100),
  13.     @fk_ticketNo nvarchar(100),
  14.     @hc_partNo nvarchar(50),
  15.     @part_returned char(10),
  16.     @defective bit,
  17.     @rma_number nvarchar(50))
  18.  
  19. AS
  20.  
  21. UPDATE tbl_CS_parts
  22.  
  23. SET
  24.  
  25.     fk_ticketNo=@fk_ticketNo,
  26.     hc_partNo=@hc_partNo,
  27.     part_returned=@part_returned,
  28.     defective=@defective,
  29.     rma_number=@rma_number
  30.  
  31.  
  32. WHERE (fk_serialNo = @fk_serialNo and  fk_ticketNo=@fk_ticketNo)

an well i tried to come up with the delete for serial an part, but not sure if this is the correct way to do it

delete serial

Expand|Select|Wrap|Line Numbers
  1. set ANSI_NULLS ON
  2. set QUOTED_IDENTIFIER ON
  3. go
  4.  
  5.  
  6. -- =============================================
  7. -- Author:        <Author,,Name>
  8. -- Create date: <Create Date,,>
  9. -- Description:    <Description,,>
  10. -- =============================================
  11. CREATE PROCEDURE [dbo].[usp_CS_Deleteserial]
  12.     -- Add the parameters for the stored procedure here
  13.     (@pka_serialNo nvarchar(100)) AS
  14.  
  15. DELETE FROM tbl_CS_serial
  16.  
  17. WHERE (pka_serialNo=@pka_serialNo and pkb_fk_ticketNo=@pkb_fk_ticketNo)
delete part

Expand|Select|Wrap|Line Numbers
  1. set ANSI_NULLS ON
  2. set QUOTED_IDENTIFIER ON
  3. go
  4.  
  5.  
  6. -- =============================================
  7. -- Author:        <Author,,Name>
  8. -- Create date: <Create Date,,>
  9. -- Description:    <Description,,>
  10. -- =============================================
  11. ALTER PROCEDURE [dbo].[usp_CS_Deleteparts]
  12. -- Add the parameters for the stored procedure here
  13.     (@fk_serialNo nvarchar(100)) 
  14. AS
  15.  
  16. DELETE FROM tbl_CS_parts
  17.  
  18.  
  19. WHERE (fk_serialNo = @fk_serialNo and  fk_ticketNo=@fk_ticketNo)
Thank you,
Rach
Oct 28 '08 #132
acoder
16,027 Expert Mod 8TB
You could have one submission page which deals with all in one go, though the form page would be different and you'd have to specify somewhere what kind of edit it is: add/delete and update.

There is also one other way you could do this: delete all serials and parts and then add them all again using the new info. This seems a bit overkill though, but would allow you to keep it all in one file and similar to what you have to an extent.

Having said that, if you're going to combine add and delete, you might as well combine update as well. I know that goes against what I said earlier, but with combining add and delete, you have to find out which ones need deleting and which ones need adding.

The best separation would be to have add, delete and update all separate for separate serials and parts. This might be too much of a change though, so I'm not sure if you'd want to go ahead with it.

If you want something quicker, then it'd probably be best to go with what you were doing up to now.
Oct 28 '08 #133
bonneylake
769 512MB
You could have one submission page which deals with all in one go, though the form page would be different and you'd have to specify somewhere what kind of edit it is: add/delete and update.

There is also one other way you could do this: delete all serials and parts and then add them all again using the new info. This seems a bit overkill though, but would allow you to keep it all in one file and similar to what you have to an extent.

Having said that, if you're going to combine add and delete, you might as well combine update as well. I know that goes against what I said earlier, but with combining add and delete, you have to find out which ones need deleting and which ones need adding.

The best separation would be to have add, delete and update all separate for separate serials and parts. This might be too much of a change though, so I'm not sure if you'd want to go ahead with it.

If you want something quicker, then it'd probably be best to go with what you were doing up to now.
Hey Acoder,

Well the most important thing to me is that it works good an i wont have to worry about to many problems. Not really worried about making a lot of changes as long as the end result works good.So whatever way you think would work best would be good for me :). But so do i need to have insert, update and delete 3 separate stored procedure or do i need to combine them? right now i have them all separate like above.

Thank you,
Rach
Oct 28 '08 #134
acoder
16,027 Expert Mod 8TB
No, the stored procedures should be separate.

As for the separation, though it makes sense, it would mean that all the code for adding/deleting using JavaScript would no longer be required because the adding and deleting would take place in stages - one by one. Do pages take a long time to load? Would it be a problem?
Oct 28 '08 #135
bonneylake
769 512MB
No, the stored procedures should be separate.

As for the separation, though it makes sense, it would mean that all the code for adding/deleting using JavaScript would no longer be required because the adding and deleting would take place in stages - one by one. Do pages take a long time to load? Would it be a problem?
Hey Acoder,

I don't think it would be a problem. I haven't had any loading problems at all.But if we remove the javascript then we won't be able to add multiple serials and parts now right? they still need to be able to add serials and parts and update ones that previously where submitted.

Thank you,
Rach
Oct 28 '08 #136
acoder
16,027 Expert Mod 8TB
You wouldn't, but it wouldn't be required. The simplest solution from where you're at is to do it all in one go. In that case, you wouldn't even need an update because everything would be deleted and then added again.
Oct 28 '08 #137
bonneylake
769 512MB
You wouldn't, but it wouldn't be required. The simplest solution from where you're at is to do it all in one go. In that case, you wouldn't even need an update because everything would be deleted and then added again.
Hey Acoder,

I understand on the deleting previously submitted and just reinsert it. But what i am confused on, is if we go in this direction. Basically the user won't be able to add more serial and more parts to the ones they have previously correct?Because the biggest thing besides for being able to put in new changes is to be able to add more parts and more serials.

Thank you,
Rach
Oct 28 '08 #138
acoder
16,027 Expert Mod 8TB
They would be able to add more serials and parts because it's assumed that everything will change, so everything is deleted first to be added with the changes. The big obvious disadvantage to this is that if you even change one single field in one single part and you have, say, 3 serials with 2 parts each, everything would be deleted and added all over again (and a side effect would be that the update takes place). If you want to avoid that, then you would need to make a separate page specially for updates and no additions/deletions would be allowed on that page.
Oct 28 '08 #139
bonneylake
769 512MB
They would be able to add more serials and parts because it's assumed that everything will change, so everything is deleted first to be added with the changes. The big obvious disadvantage to this is that if you even change one single field in one single part and you have, say, 3 serials with 2 parts each, everything would be deleted and added all over again (and a side effect would be that the update takes place). If you want to avoid that, then you would need to make a separate page specially for updates and no additions/deletions would be allowed on that page.
Hey Acoder,

Well the deleting is not a big deal. To be honest i have doubts that many changes will be made to it, except to say that this problem has been closed (but you never know). But as long as they can still add multiple serials and parts then i am ready to go. Where do we begin?

Thank you,
Rach
Oct 28 '08 #140
acoder
16,027 Expert Mod 8TB
OK, the first thing you need to do is add a delete query which deletes parts and serials, so you could use two stored procedures, or you could use one cascading delete where if you delete serials, the parts are also deleted.
Oct 28 '08 #141
bonneylake
769 512MB
OK, the first thing you need to do is add a delete query which deletes parts and serials, so you could use two stored procedures, or you could use one cascading delete where if you delete serials, the parts are also deleted.
Hey Acoder,

I have already created 2 delete querys. One for parts and serials. I am not sure if this is the correct way to do a delete stored procedure. Here is what i have.

delete for serial
Expand|Select|Wrap|Line Numbers
  1. set ANSI_NULLS ON
  2. set QUOTED_IDENTIFIER ON
  3. go
  4.  
  5.  
  6. -- =============================================
  7. -- Author:        <Author,,Name>
  8. -- Create date: <Create Date,,>
  9. -- Description:    <Description,,>
  10. -- =============================================
  11. CREATE PROCEDURE [dbo].[usp_CS_Deleteserial]
  12.     -- Add the parameters for the stored procedure here
  13.     (@pka_serialNo nvarchar(100),
  14.      @pkb_fk_ticketNo nvarchar(100)) AS
  15.  
  16. DELETE FROM tbl_CS_serial
  17.  
  18. WHERE (pka_serialNo=@pka_serialNo and pkb_fk_ticketNo=@pkb_fk_ticketNo)
delete for parts
Expand|Select|Wrap|Line Numbers
  1.  set ANSI_NULLS ON
  2. set QUOTED_IDENTIFIER ON
  3. go
  4.  
  5.  
  6. -- =============================================
  7. -- Author:        <Author,,Name>
  8. -- Create date: <Create Date,,>
  9. -- Description:    <Description,,>
  10. -- =============================================
  11. CREATE PROCEDURE [dbo].[usp_CS_Deleteparts]
  12. -- Add the parameters for the stored procedure here
  13.     (@fk_serialNo nvarchar(100),
  14.      @fk_ticketNo nvarchar(100)) 
  15. AS
  16.  
  17. DELETE FROM tbl_CS_parts
  18.  
  19.  
  20. WHERE (fk_serialNo = @fk_serialNo and  fk_ticketNo=@fk_ticketNo)
Thank you,
Rach
Oct 28 '08 #142
acoder
16,027 Expert Mod 8TB
Do you use these delete queries anywhere else? If not, it might be an idea to write one which removes all parts and serials for a particular ticket in one (or possibly two) queries. Either way, this is OK too, the only difference being that you'll have to have a nested loop deleting all serials and parts one by one.
Oct 28 '08 #143
bonneylake
769 512MB
Do you use these delete queries anywhere else? If not, it might be an idea to write one which removes all parts and serials for a particular ticket in one (or possibly two) queries. Either way, this is OK too, the only difference being that you'll have to have a nested loop deleting all serials and parts one by one.
Hey Acoder,

Nope the 2 delete queries are not used anywhere else. So how would i combine the 2 into one query? it was hard to find example online of just trying to delete.

Thank you,
Rach
Oct 28 '08 #144
acoder
16,027 Expert Mod 8TB
Well, it's not strictly necessary, just a performance issue should you need to go back to it.

In your action page, add a loop that loops over the serials and within that loop, loops over the parts and deletes them one by one, followed by a deletion of the serial for that loop iteration. The cfloop tags would be similar to what you have for addition.
Oct 28 '08 #145
bonneylake
769 512MB
Well, it's not strictly necessary, just a performance issue should you need to go back to it.

In your action page, add a loop that loops over the serials and within that loop, loops over the parts and deletes them one by one, followed by a deletion of the serial for that loop iteration. The cfloop tags would be similar to what you have for addition.
Hey Acoder,

Well do you have a suggestion on where i could find an example on how to delete records from 2 tables? having a hard time finding an example online.

An are you meaning something like this for the cfloop, was not sure what type of cfloop they should be so i just left them <cfloop>. but is where i place the 2 cfloop's correct?

Expand|Select|Wrap|Line Numbers
  1. <!---Inserts information into serial table.--->
  2. <CFIF REQUEST_METHOD EQ "POST">
  3. <CFSET machineListLen = listLen(Form.serialcount)>
  4. <cfloop>
  5. <CFLOOP from="1" to="#machineListLen#" index="machineCount">
  6.  <CFSET serialnum       = Form["serialnum_" & machineCount]>
  7.  <CFSET modelno         = Form["modelno_" & machineCount]>
  8.  <CFSET producttype     = Form["producttype_" & machineCount]>
  9.  <CFSET softhardware    = Form["softhardware_" & machineCount]>
  10.  <CFSET resolution      = Form["resolution_" & machineCount]>
  11.  <CFSET resdate         = Form["resdate_" & machineCount]>
  12.  <CFSET resvertified    = Form["resvertified_" & machineCount]>
  13.  <CFSET vertifidate     = Form["vertifidate_" & machineCount]>
  14.  <CFSET deptvendor      = Form["deptvendor_" & machinecount]>
  15.  <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
  16. <CFSET thedescription  = Form["thedescription_" & machineCount]>
  17.  
  18.  
  19. <!--- inserts information into the serial table--->
  20. <cfquery name="serialinsertupdate" datasource="CustomerSupport">
  21.    exec usp_CS_Updateserial 
  22.      <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  23.      "#Form.pk_ticketID#",
  24.      <cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
  25.      <cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
  26.      <cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
  27.      <cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
  28.      <cfqueryparam value="#resdate#">,
  29.      <cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
  30.      <cfqueryparam value="#vertifidate#">,
  31.      <cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
  32.      <cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">   
  33.      </cfquery>
  34.  
  35. <!---Inserts information into notes_descr table.--->
  36. <cfquery name="description" datasource="CustomerSupport">
  37.     exec usp_CS_Insertdescription
  38.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  39.    '#Form.pk_ticketID#',
  40.    <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
  41.    '#Form.fk_addedBy#'
  42. </cfquery>
  43.  
  44. <!---Inserts parts information into parts table.--->
  45. <!---because it is a bit we don't use 'ticks' around defective for parts table--->
  46. <cfloop list="#form['part2count' & machinecount]#" index="ps">
  47. <cfloop>
  48. <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
  49. <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
  50. <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
  51. <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
  52. <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
  53. <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
  54. <cfquery name="parts" datasource="CustomerSupport">
  55.     exec usp_CS_Updateparts 
  56.     <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  57.     '#Form.pk_ticketID#',
  58.     <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
  59.     <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
  60.     <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">,
  61.     <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">
  62. </cfquery>
  63. </cfloop>
  64. </cfloop>
  65. </cfloop>
  66. </CFLOOP>
  67. </CFIF>
Thank you,
Rach
Oct 28 '08 #146
acoder
16,027 Expert Mod 8TB
You can search for "delete cascade". If you have problems, ask in the SQL Server forum.

On the other hand, if you want to stick with what you've got and work with Coldfusion, you can use a loop to delete serials and parts one by one instead. I'll correct myself and say that you only need one loop. Copy lines 3 and 5 and put them above line 1. Now you have the beginning of the loop. First you would delete the parts that have the serial id (as foreign key) and then the serial.
Oct 28 '08 #147
bonneylake
769 512MB
You can search for "delete cascade". If you have problems, ask in the SQL Server forum.

On the other hand, if you want to stick with what you've got and work with Coldfusion, you can use a loop to delete serials and parts one by one instead. I'll correct myself and say that you only need one loop. Copy lines 3 and 5 and put them above line 1. Now you have the beginning of the loop. First you would delete the parts that have the serial id (as foreign key) and then the serial.
Hey Acoder,

do i need to delete the 2 <cfloop> i had created before. here is what i have.
Expand|Select|Wrap|Line Numbers
  1. <!---Inserts information into serial table.--->
  2. <CFSET machineListLen = listLen(Form.serialcount)>
  3. <CFLOOP from="1" to="#machineListLen#" index="machineCount">
  4. <CFIF REQUEST_METHOD EQ "POST">
  5. <cfloop>
  6.  <CFSET serialnum       = Form["serialnum_" & machineCount]>
  7.  <CFSET modelno         = Form["modelno_" & machineCount]>
  8.  <CFSET producttype     = Form["producttype_" & machineCount]>
  9.  <CFSET softhardware    = Form["softhardware_" & machineCount]>
  10.  <CFSET resolution      = Form["resolution_" & machineCount]>
  11.  <CFSET resdate         = Form["resdate_" & machineCount]>
  12.  <CFSET resvertified    = Form["resvertified_" & machineCount]>
  13.  <CFSET vertifidate     = Form["vertifidate_" & machineCount]>
  14.  <CFSET deptvendor      = Form["deptvendor_" & machinecount]>
  15.  <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
  16. <CFSET thedescription  = Form["thedescription_" & machineCount]>
  17.  
  18.  
  19. <!--- inserts information into the serial table--->
  20. <cfquery name="serialinsertupdate" datasource="CustomerSupport">
  21.    exec usp_CS_Updateserial 
  22.      <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  23.      "#Form.pk_ticketID#",
  24.      <cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
  25.      <cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
  26.      <cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
  27.      <cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
  28.      <cfqueryparam value="#resdate#">,
  29.      <cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
  30.      <cfqueryparam value="#vertifidate#">,
  31.      <cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
  32.      <cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">   
  33.      </cfquery>
  34.  
  35. <!---Inserts information into notes_descr table.--->
  36. <cfquery name="description" datasource="CustomerSupport">
  37.     exec usp_CS_Insertdescription
  38.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  39.    '#Form.pk_ticketID#',
  40.    <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
  41.    '#Form.fk_addedBy#'
  42. </cfquery>
  43.  
  44. <!---Inserts parts information into parts table.--->
  45. <!---because it is a bit we don't use 'ticks' around defective for parts table--->
  46. <cfloop list="#form['part2count' & machinecount]#" index="ps">
  47. <cfloop>
  48. <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
  49. <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
  50. <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
  51. <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
  52. <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
  53. <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
  54. <cfquery name="parts" datasource="CustomerSupport">
  55.     exec usp_CS_Updateparts 
  56.     <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  57.     '#Form.pk_ticketID#',
  58.     <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
  59.     <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
  60.     <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">,
  61.     <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">
  62. </cfquery>
  63. </cfloop>
  64. </cfloop>
  65. </cfloop>
  66. </CFLOOP>
  67. </CFIF>
an will this work for the delete for both serial and parts?
Expand|Select|Wrap|Line Numbers
  1. set ANSI_NULLS ON
  2. set QUOTED_IDENTIFIER ON
  3. go
  4.  
  5.  
  6. -- =============================================
  7. -- Author:        <Author,,Name>
  8. -- Create date: <Create Date,,>
  9. -- Description:    <Description,,>
  10. -- =============================================
  11. CREATE PROCEDURE [dbo].[usp_CS_Deletesp]
  12.     -- Add the parameters for the stored procedure here
  13.     (@pka_serialNo nvarchar(100),
  14.      @pkb_fk_ticketNo nvarchar(100),
  15.      @fk_serialNo nvarchar(100),
  16.      @fk_ticketNo nvarchar(100)) AS
  17.  
  18. DELETE FROM tbl_CS_serial
  19. WHERE (pka_serialNo=@pka_serialNo and pkb_fk_ticketNo=@pkb_fk_ticketNo)
  20.  
  21. DELETE FROM tbl_CS_parts
  22. WHERE (fk_serialNo = @fk_serialNo and  fk_ticketNo=@fk_ticketNo)
  23.  
  24.  
Thank you,
Rach
Oct 28 '08 #148
acoder
16,027 Expert Mod 8TB
If you're going to use one stored procedure to delete all serials and parts, then you won't need the loop code in Coldfusion.

If you're going the SQL Server route, the best solution would probably be a delete cascade, but you may want to make sure firstly that your version of SQL Server supports it and secondly ask the experts in the SQL Server forum if they have any suggestions. If that's not possible, the solution would be to delete from parts first and then from serials. You only need the ticket number.
Oct 28 '08 #149
bonneylake
769 512MB
If you're going to use one stored procedure to delete all serials and parts, then you won't need the loop code in Coldfusion.

If you're going the SQL Server route, the best solution would probably be a delete cascade, but you may want to make sure firstly that your version of SQL Server supports it and secondly ask the experts in the SQL Server forum if they have any suggestions. If that's not possible, the solution would be to delete from parts first and then from serials. You only need the ticket number.
Hey Acoder,

Well the reason i am doing the SQL server route is because you said i could run into problems later doing it the other way, which trying to avoid as many problems as possible. But i thought that was a delete cascade? it was the only example i could find online that deleted from 2 tables. Only ones i could find where ones that had delete and update or would delete from one table.Do you know of a better way to search it? i tried delete cascade, i tried sql server stored procedure delete cascade. Really hard to find an example.

Thank you,
Rach
Oct 29 '08 #150

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: euang | last post by:
Hi, I have been using access 2000 for two years on WINDOWS NT to display dynamic aweb page using ASP My ISP has now changed to Windows 2003, and I am having major problems displaying...
5
by: Sue | last post by:
As soon as a character is entered in the first field of a new record, the number of records shown in the navigation buttons increases by 1 and the new record button becomes enabled. In the...
3
by: Robin S. | last post by:
I tried to ask this question several days ago, but I didn't explain my application correctly. Basically I want to have one record from table "A" and I want to display, say, 5 records from table...
4
by: Vigneshwar Pilli via DotNetMonster.com | last post by:
Hey, Well, I have a Problem. I have designed a table which has few fields which are being declared in the database of type .... char of length 10. and other fields with varchar 50 and...
0
by: hbomb | last post by:
I have a form which is used to both enter data for an application and to view a snapshot of previous data entered for students. The database’s initial point of entry is a form called INTERESTED...
1
by: NumberCruncher | last post by:
Hi All, I am struggling with setting up my first system of tables, forms,and reports, and could use your help! I am setting up a database to keep track of the production of a produced item. The...
8
by: banderson | last post by:
Hello, I have a combo box in which I want to display multiple fields by concatenating the fields together. If one of those concatenated fields is Null, then the combo box does not show anything. To...
4
by: bonneylake | last post by:
Hey Everyone, Well this is probably a pretty easy question, but for some reason i just can not figure it out. What i am trying to do is redisplay what was entered previously. I have figured...
3
by: chuck gregory | last post by:
I'm using the 2002 (10.6771.6845) SP3 Access program. I have a form that will not show previously entered data. It has about 45 fields. I will call it the "parent" form. The "parent" form was at...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.