469,300 Members | 2,227 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,300 developers. It's quick & easy.

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 24509
bonneylake
769 512MB
It wouldn't go there. It would have to go in the serial div - one for each serial. Also, it would have to be named "partcounter1", "partcounter2", etc. depending on the number of the serial. You would also need to add this field to the addInput function.
Hey Acoder,

Here is what i added in addInput

Expand|Select|Wrap|Line Numbers
  1. "<input type='hidden' name='partcounter' id='partcounter' value='" + count + "'>";
and here is what i added in html

Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" value="#count#" name="partcounter#count#" id="partcounter" />
ok i did the above an its adding parts but its weird.Its Counting like serials would count, an it doesnt start the count over again for each serial like we had it before where it was like this

serial 1
part 1

serial 2
part 1

an then the other problem i am noticing is i inserted a serial and part. An then i went an edited it an it edited fine. But then when i came to look back at it, the parts is completely gone an the serial added another duplicate!


Thank you,
Rach
Nov 6 '08 #201
acoder
16,027 Expert Mod 8TB
You'll need to add the serial number to the name and ID in both addInput and the HTML. In addInput, the value would be 0 because there's no parts to begin with for a new serial. In the HTML, the value would be the total parts count, not the serial count.

PS. Gosh! 200+ posts!
Nov 6 '08 #202
bonneylake
769 512MB
You'll need to add the serial number to the name and ID in both addInput and the HTML. In addInput, the value would be 0 because there's no parts to begin with for a new serial. In the HTML, the value would be the total parts count, not the serial count.

PS. Gosh! 200+ posts!
Hey Acoder,

Yeah..sorry about the 200 posts. This is just tough one.

But in the javascript i put the following
Expand|Select|Wrap|Line Numbers
  1. "<input type='hidden' name='partcounter "+ count +"' id='partcounter "+ count +"' value='0'>";

and in the html i put the following

Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="partcounter#count#" id="partcounter#count#" value="#count1#" />
an the only problem right now is i can add parts to a serial previously submitted. but if i add a serial i can not add a part to that serial but i can add a part to a previously submitted serial..this is what i have in javascript to add it
Expand|Select|Wrap|Line Numbers
  1. "<input type='button' class='addticket' value='Add Parts' onclick=\"addpartInput(\'"+divIdName+"\')\">" +
Thank you,
Rach
Nov 6 '08 #203
acoder
16,027 Expert Mod 8TB
No need to apologise. It's a pretty complex problem overall.

You have a space in "partcounter " in the JavaScript code that you need to remove for both name and ID.
Nov 6 '08 #204
bonneylake
769 512MB
No need to apologise. It's a pretty complex problem overall.

You have a space in "partcounter " in the JavaScript code that you need to remove for both name and ID.
Hey Acoder,

Alright so no more problems with adding or removing serials and parts. But i am still running into a problem.Now when i update, now its not updating the record or inserting new serial/parts at all. It just shows the same previously submitted serial and part (but its not duplicating).

an well i think i know why its not inserting. in the cfloop for parts we use
Expand|Select|Wrap|Line Numbers
  1. <cfloop list="#form['part2count' & machinecount]#" index="ps"> 
what would i change part2count to?


Thank you,
Rach
Nov 6 '08 #205
acoder
16,027 Expert Mod 8TB
Yes, that's correct. You would change that to "partscount" & machinecount.
Nov 7 '08 #206
bonneylake
769 512MB
Yes, that's correct. You would change that to "partscount" & machinecount.
Hey Acoder,

When i tried that i got the error

An error occurred while evaluating the expression:


"#form['partscount' & machinecount]#"


Error near line 91, column 20.
--------------------------------------------------------------------------------

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

here is what i have

Expand|Select|Wrap|Line Numbers
  1. <cfloop list="#form['partscount' & 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>
an i don't know if this is right so wanted to double check. but i have the following 2 fields under the parts section of the html an wanted to ask does partcounter need to be under the serial like we have in the javascript or where it is at now?

Expand|Select|Wrap|Line Numbers
  1. <cfquery name="getparts" dbtype="query" >
  2. SELECT *
  3. FROM parts
  4. WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
  5. cfsqltype="cf_sql_char" maxLength="20">
  6. </cfquery>
  7. <cfset count1 = 0>
  8. <cfloop query="getparts">
  9. <cfset count1 = count1 + 1>
  10. <div id="part#count1#Name#count#">
  11.  
  12.  
  13. <input type="hidden" name="partscount" id="partscount" value="#count1#">
  14. <input type="hidden" name="partcounter#count#" id="partcounter#count#" value="#count1#" />
  15. <!---THIS IS THE PARTS SECTION--->

Thank you,
Rach
Nov 7 '08 #207
acoder
16,027 Expert Mod 8TB
There's two problems. Those two fields need to be outside the part divs and the partscount field should have the serial no. attached to its name/id.
Nov 7 '08 #208
bonneylake
769 512MB
There's two problems. Those two fields need to be outside the part divs and the partscount field should have the serial no. attached to its name/id.
Hey Acoder,

This thing has got to hate me. It still doing duplicates "sigh".The only thing i can think of is something to do with maybe how the information is being displayed? or else i put those 2 fields in the wrong section. Heres what i got

the javascript
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. "<input type='hidden' name='partcounter"+ count +"' id='partcounter"+ count +"' value='0'>";
  164.  
  165.  
  166. <!--- Adds Delete to every ticket  --->
  167. newdiv.innerHTML = newdiv.innerHTML +
  168. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  169. "<tr>" +
  170. "<td>" +
  171. "<input type='button' class='removeticket' value='Remove Serial &quot;"+ count +"&quot;' onclick=\"removeElement(\'"+divIdName+"\')\"></a>" +
  172. "</td>" +
  173. "</tr>" +
  174. "<tr>" +
  175. "<td>" + 
  176. "<input type='button' class='addticket' value='Add Parts' onclick=\"addpartInput(\'"+divIdName+"\')\">" +
  177. "</td>" +
  178. "</tr>" +
  179. "</table>";
  180.  
  181. document.getElementById(divName).appendChild(newdiv);
  182.  
  183. <!---Allows us to remove multiple fields --->
  184. function removeElement(divNum) {
  185.   var d = document.getElementById('dynamicInput');
  186.   var olddiv = document.getElementById(divNum);
  187.   d.removeChild(olddiv);
  188. }
  189. </script>
  190.  
  191.  
  192.  
  193.  
  194.  
  195. <!---Allows us to add PARTS information multiple times--->
  196. <script type="text/javascript">
  197. <!---Adds multiple fields for parts --->
  198. function addpartInput(partName){
  199. var parts = document.getElementById(partName);
  200. <!---('partsInput')--->
  201.  
  202. <!---this works if only want to add a part under the serial you are working with, but if you have
  203. serial information 1
  204. 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--->
  205. var getparts = document.getElementById('div');
  206. <!---var avalue = document.getElementById('aValue');--->
  207. var serialno = partName.replace("dynamic","").replace("Input","");
  208. var avalue = document.getElementById("partcounter"+serialno);
  209. <!---var count = (document.getElementById('avalue').value -1)+ 2;--->
  210. var count = parseInt(avalue.value) + 1;
  211. avalue.value = count;
  212. <!---var partslist = document.getElementById("part2count"+serialno);
  213. partslist.value += count + ",";--->
  214. var partdiv = document.createElement('div');
  215. <!---var partIdName = 'part'+count+'Name';--->
  216. var partIdName = 'part' + count + 'Name' + serialno;
  217. <!---'parts'+count+'Input'--->
  218.  
  219. partdiv.setAttribute('id',partIdName);
  220.  
  221. <!--- Adds Extra fields for parts table  --->
  222. partdiv.innerHTML =
  223. <!---what used originally for this tableclass='createticketables' id='spaceup'--->
  224. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' >" +
  225. "<th class='sectiontitle' colspan='7'>Parts Information "+ count +" Serial Information "+serialno+"</th>" +
  226. "<tr>" +
  227. "<td class='indent' id='formfieldpadding'>HC P/N:&nbsp;&nbsp;&nbsp;" +
  228. "<input type='text' name='hcpn_" + count + "_"+serialno+"' style='margin:0px'></td>" +
  229. "<td>" +
  230. "Parts been returned* " +
  231. "<input type='checkbox' name='partsreturn_" + count + "_"+serialno+"' value='1'>" +
  232. "</td>" +
  233. "<td>" +
  234. "<td class='indent'>Defective<input type='checkbox' name='defective_" + count +"_"+serialno+"' value='1'>" +
  235. "</td>" +
  236. "</td>" +
  237. "</tr>" +
  238. "</table>";
  239.  
  240.  
  241. <!--- Adds Extra fields for RMA Data Only  --->
  242. partdiv.innerHTML = partdiv.innerHTML +
  243. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  244. "<tr>" +
  245. "<td id='paddingformultitop'>" +
  246. "RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;" +
  247. "</td>" +
  248. "<td class='rmanmoveinmulti'>" +
  249. "( You may enter up to 1000 characters. )"+
  250. "<br/>" +
  251. "<textarea maxlength='1000' onkeyup='return rmamaxlength(this)' onkeydown='return rmamaxlength(this)' rows='4' cols='60' name='rma_" + count + "_"+serialno+"'></textarea> " +
  252. "</td>" +
  253. "</tr>" +
  254. "</table>" +
  255. "<input type='hidden' name='partscount" + serialno + "' value='" + count + "'>";
  256.  
  257.  
  258.  
  259. <!--- Adds Delete to every ticket  --->
  260. partdiv.innerHTML = partdiv.innerHTML +
  261. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  262. "<tr>" +
  263. "<td>" +
  264. "<input type='button' class='removeticket' value='Remove Parts &quot;"+count +"&quot;' onclick=\"removetheElement('"+partIdName+"',"+serialno+","+count+")\"></a>" +
  265. "</td>" +
  266. "</td>" +
  267. "</tr>" +
  268. "</table>";
  269.  
  270. document.getElementById(partName).appendChild(partdiv);
  271.  
  272. <!---Allows us to remove multiple fields--->
  273. function removetheElement(divNum, serialno, partnum) {
  274.   <!---var d = document.getElementById('partsInput');--->
  275. <!---  var partslist = document.getElementById("part2count"+serialno);
  276.   partslist.value = partslist.value.replace(partnum+',',"");--->
  277.   var olddiv = document.getElementById(divNum);
  278.  olddiv.parentNode.removeChild(olddiv);
  279. }
  280.  
  281. </script>
the html




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

When you see duplicates, is the count the same for the second serial?
Nov 7 '08 #210
bonneylake
769 512MB
Is the previous problem solved? I still notice that the parts input fields are not quite in the right place. They should be outside the getparts loop, but inside the serial cfoutput loop.

When you see duplicates, is the count the same for the second serial?
Hey Acoder,

Yes the inserting is working correctly. But the thing is if its outside the getparts loop then it wont be able to get the value for count1 right? because it uses the following to get the count.

Expand|Select|Wrap|Line Numbers
  1. <cfset count1 = 0>
  2. <!---<cfif serial.recordcount is 0>--->
  3. <cfloop query="getparts">
  4. <cfset count1 = count1 + 1>
An with the serial its counting correctly. When it does duplicates it is counting correctly. If i had a previously submitted one that was serial information 1, when it duplicates it you see serial information 1 and then it makes serial information 2 below it.an all the fields an everything says serial information 2.

Thank you,
Rach
Nov 7 '08 #211
acoder
16,027 Expert Mod 8TB
Sorry, the partscount field is in the right place. It's the partcounter field that needs to be moved about 2/3 lines lower because you only need one per serial.
Nov 7 '08 #212
bonneylake
769 512MB
Sorry, the partscount field is in the right place. It's the partcounter field that needs to be moved about 2/3 lines lower because you only need one per serial.
Hey Acoder,

Ok so would this be correct?

Expand|Select|Wrap|Line Numbers
  1. <!--- Adds Delete to every ticket  --->
  2. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  3. <tr>
  4. <td>
  5. <input type="button" class="removeticket" value="Remove Parts #count1#" 
  6. onclick="removetheElement('part#count1#Name#count#',#count#,#count#)"></a>
  7. </td>
  8. </td>
  9. </tr>
  10. </table>
  11. </div>
  12. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#">
  13.  
  14. </cfloop>
  15. </div> 
  16. <input type="hidden" name="partcounter#count#" id="partcounter#count#" value="#count1#" />
  17. </cfoutput>
  18. <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
Thank you,
Rach
Nov 7 '08 #213
acoder
16,027 Expert Mod 8TB
That looks about right.
Nov 7 '08 #214
bonneylake
769 512MB
That looks about right.
Hey Acoder,

I tried it but i am still getting duplicates. I think i know what the problem is. I first took out everything extra that i didn't need to make the multiple fields work, that was not the problem. I then took out everything involving parts including javascript and html. That was not causing the problem. I finally took out everything javascript related an that was not causing the problem. The problem is with the serial section in the html. I think the count is adding extra to it. i tried renaming count from count to thecount an that didn't seem to make a difference at all an still is inserting duplicate. But it says its the html for the serial section is whats causing it cause i took everything else out except the display for serial section an it still duplicated.


and here is the html for serial
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. <cfset count = 0>
  9. <!---<cfif serial.recordcount is 0>--->
  10. <cfoutput query="serial">
  11. <cfset model_no = #model_no#>
  12. <cfset product_type = #product_type#>
  13. <cfset type_hardware_failure = #type_hardware_failure#>
  14. <cfset software_hardware = #software_hardware#>
  15. <cfset resolution_verified_by = #resolution_verified_by#>
  16. <cfset dept_responsibility = #dept_responsibility#>
  17. <cfset count = count + 1>
  18.  <!--- Shows what was previously entered for Model No, Product Type, and Type of Hardware Failure  --->
  19. <div id="dynamic#count#Input"> 
  20. <table class="zpExpandedTable" id="modeltable"> 
  21. <th class="sectiontitletick" colspan="7">
  22. Serial Information #count# </th>
  23. <tr>
  24. <td id="paddingformultitop">Model No:&nbsp;&nbsp;&nbsp;&nbsp;</td>
  25. </td>
  26. <td>
  27. <select name="modelno_#count#">
  28. <option value="">Make A Selection</option>
  29. <cfloop query="models">
  30. <option value="#model#"<cfif #model# is #model_no#>selected</cfif>>#model#</option>
  31. </cfloop> 
  32. </select>
  33. </td>
  34. <td>
  35. &nbsp;&nbsp;&nbsp;&nbsp;Product Type:
  36. </td>
  37. <td>
  38. <select name="producttype_#count#">
  39. <option value="" selected>No Choice</option>
  40. <cfloop query="getProdType">
  41. <option value="#pk_productType#"<cfif #pk_productType# is #product_type#>selected</cfif>>#pk_productType#</option> 
  42. </cfloop>
  43. </select>
  44. </td>
  45. <td class="red">
  46. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type Of Hardware Failure*:
  47. </td>
  48. <td>
  49. <select name="hardwarefailure_#count#">
  50. <option value="" selected>Make A Selection</option>
  51. <cfloop query="getHardwareFail">
  52. <option value="#pk_hardwareFailure#"<cfif #pk_hardwareFailure# is #type_hardware_failure#>selected</cfif>>#pk_hardwareFailure#</option>
  53. </cfloop>
  54. </select>
  55. </td>
  56. </tr>
  57. <table>
  58.  
  59. <!--- Shows what was previously entered for Serial Number and Software/Hardware  --->
  60. <table class="zpExpandedTable" id="modeltable">
  61. <tr>
  62. <td id="paddingformultitop">
  63. Serial Number:&nbsp;&nbsp;
  64. <input type="text" name="serialnum_#count#" value="#pka_serialNo#">
  65. &nbsp;&nbsp;&nbsp;&nbsp;Software/Hardware:&nbsp;&nbsp;
  66. <select name="softhardware_#count#">
  67. <option value="" selected>No Choice</option>
  68. <cfloop query="getSoftHard">
  69. <option value="#pk_softwareHardware#"<cfif #pk_softwareHardware# is #software_hardware#>selected</cfif>>#pk_softwareHardware#</option>
  70. </cfloop>
  71. </select>
  72. </td>
  73. </tr>
  74. </table>
  75.  
  76. <!--- Shows what was previously entered for Description ---> 
  77.  
  78. <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
  79. <tr>
  80. <td id="paddingformutli">
  81. Description:&nbsp;&nbsp;
  82. </td>
  83. <td class="descriptionmoveinmulti">
  84. #description#
  85. ( You may enter up to 1000 characters. )
  86. <br>
  87. <textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name="thedescription_#count#"></textarea>
  88. </td>
  89. </tr>
  90. </table>
  91.  
  92. <!---Shows what was previously entered for Resolution  --->
  93.  
  94. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  95. <tr>
  96. <td id="paddingformutli">
  97. Resolution:&nbsp;&nbsp;
  98. </td>
  99. <td class="resolutionmoveinmulti">
  100. ( You may enter up to 1500 characters. )
  101. <br>
  102. <textarea  maxlength="1500" onkeyup="return resolutionismaxlength(this)" onkeydown="return resolutionismaxlength(this)" rows="4" cols="60" name="resolution_#count#">#resolution#</textarea>
  103. </td>
  104. </tr>
  105. </table>
  106.  
  107. <!--- Shows what was previously entered for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by  --->
  108.  
  109. <table class="zpExpandedTable" id="resoldatetab" cellpadding="1" cellspacing="0">
  110. <tr>
  111. <td id="paddingformultitop">
  112. Resolution Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
  113. </td>
  114. <td>
  115. <input type="text" name="resdate_#count#" value="#DateFormat(resolution_date,'mm/dd/yyyy')#">&nbsp;&nbsp;
  116. &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
  117. <input type="checkbox" name="currentdateresol_#count#" 
  118. onClick="resdate_#count#.value=fill_date()">
  119. </td>
  120. <td>
  121. Resolution Verified as effective by:&nbsp;&nbsp;
  122. </td>
  123. <td>
  124. <select name="resvertified_#count#">
  125. <option value="" selected>Make A Selection</option>
  126. <cfloop query="gettech">
  127. <option value="#fname# #lname#"<cfif "#fname# #lname#" is #resolution_verified_by#>
  128. selected</cfif>>#fname# #lname#</option>
  129. </cfloop>
  130. </select>
  131. </td>
  132. </tr>
  133. </table>
  134. <!--- Shows what was previously entered for Vertification Date, Current Date (for vertification date)   --->
  135. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  136. <tr>
  137. <td id="paddingformultitop">
  138. Verification Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
  139. </td>
  140. <td class="vertificationmoveinmulti">
  141. <input type="text" name="vertifidate_#count#" value="#DateFormat(verification_date,'mm/dd/yyyy')#">&nbsp;&nbsp;
  142. &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
  143. <input type="checkbox" name="currentdatevert_#count#" 
  144. onClick="vertifidate_#count#.value=fill_date()">
  145. </td>
  146. </tr>
  147. </table>
  148.  
  149. <!--- Shows what was previously entered for Dept/Vendor Responsibility  --->
  150. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  151. <tr>
  152. <td class="red" id="paddingformultitop">
  153. Dept/Vendor Responsibility*:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  154. <select name="deptvendor_#count#">
  155. <option value="" selected>Make A Selection</option>
  156. <cfloop query="getDeptVendor">
  157. <option value="#pk_deptVendor#"<cfif #pk_deptVendor# is #dept_responsibility#>selected</cfif>>#pk_deptVendor#</option>
  158. </cfloop>
  159. </select>
  160. </td>
  161. </tr>
  162. </table>
  163.  
  164.  
  165. <input type="hidden" name="serialcount" id="serialcount" value="#count#">
  166. <!--- Adds Delete to every ticket  --->
  167. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  168. <tr>
  169. <td>
  170. <input type="button" class="removeticket" value="Remove Serial #count#" onclick="removeElement('dynamic#count#Input')">
  171. </td>
  172. </tr>
  173. <tr>
  174. <td>
  175. <input type="button" class="addticket" value="Add Parts" onclick="addpartInput('dynamic#count#Input')">
  176. </td>
  177. </tr>
  178. </table>
  179. </div>
  180. </cfoutput>
  181. <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
  182. </div>
  183.      <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
Thank you,
Rach
Nov 7 '08 #215
bonneylake
769 512MB
Hey Acoder,

I have definately determined that these lines in the html are causeing it

Expand|Select|Wrap|Line Numbers
  1. <cfset count = 0>
  2. <!---<cfif serial.recordcount is 0>--->
  3. <cfoutput query="serial">
  4. <cfset count = count + 1>
well this is my guess on how its doing it. Basically when you first go to the edit page for the first time your serial has a default of 0. However, since we have count + 1 it then makes it serial information 1. When i submit it an go back to look at it. All the information is serial information 1 an so basically it goes and adds another one since we have count +1 which makes the duplicate. Sorry if thats confusing but its kinda hard to explain. But i been messing with the count for a while an thats how it came to me. But i have no clue what i could change the count to to make it work right. any suggestions?

Thank you,
Rach
Nov 7 '08 #216
acoder
16,027 Expert Mod 8TB
I won't have time to look at this until probably Monday at the earliest, but well done on what you've managed so far. I suspected the problem would be in the HTML display code. Hopefully, you'll have found something by then. If not, Monday it is.
Nov 7 '08 #217
acoder
16,027 Expert Mod 8TB
I have definately determined that these lines in the html are causeing it

Expand|Select|Wrap|Line Numbers
  1. <cfset count = 0>
  2. <!---<cfif serial.recordcount is 0>--->
  3. <cfoutput query="serial">
  4. <cfset count = count + 1>
well this is my guess on how its doing it. Basically when you first go to the edit page for the first time your serial has a default of 0. However, since we have count + 1 it then makes it serial information 1. When i submit it an go back to look at it. All the information is serial information 1 an so basically it goes and adds another one since we have count +1 which makes the duplicate.
I doubt that would be the case because of the first line which sets count to 0, so whenever you visit the page, the count is initially 0.

When you revisit the page and see the duplicates, can you show an example of the generated HTML (as seen in the browser)?
Nov 10 '08 #218
bonneylake
769 512MB
I doubt that would be the case because of the first line which sets count to 0, so whenever you visit the page, the count is initially 0.

When you revisit the page and see the duplicates, can you show an example of the generated HTML (as seen in the browser)?
Hey Acoder,

Alrighty here are some pictures. The first picture shows the original previously submitted serial and half of the duplicate. An the second picture shows the duplicate

first picture
http://img221.imageshack.us/my.php?image=serial1rx6.jpg

second picture
http://img380.imageshack.us/my.php?i...l1othervk5.jpg

an also forgot to mention. For some reason when i go back an look it doesn't show the part i added. I originally had 1 serial and 1 part. Its been doing this recently where it will show if i go to previously look at it the one serial and one part. But when i resubmit it an go back an look it only shows the serial.

Thank you,
Rach
Nov 10 '08 #219
acoder
16,027 Expert Mod 8TB
I did mean the actual HTML code rather than a picture, but that will do.

As far as I can see, the Coldfusion code looks OK. What I suggest you try is to test the serial query in the SQL Server Query Analyzer. Does it produce the same output, i.e. two duplicate records for the same ticket?
Nov 10 '08 #220
bonneylake
769 512MB
I did mean the actual HTML code rather than a picture, but that will do.

As far as I can see, the Coldfusion code looks OK. What I suggest you try is to test the serial query in the SQL Server Query Analyzer. Does it produce the same output, i.e. two duplicate records for the same ticket?
Hey Acoder,

I am not sure how i would test the query using the sql server query analyzer. But i know for a fact that it has not inserting duplicate records.I have checked multiple times the table an i only see one record. Also, each ticket has to have a unique serial number meaning if i have serial 1 and serial 2 it will insert fine. However, if i try to insert serial 1 and serial 1 it will not insert and will give me an error due to you can not insert the same serial name twice with the same ticket. It don't matter if any of the other information is different, as long as the serial names are the same an error will occur. Right now if i tried to insert the duplicate you seen it would give me an error an would not insert. However, if i delete the duplicate and just insert serial 1 it will insert with no problems. However if i went back an looked instead of having serial 1 and the duplicate you would then have a second duplicate of serial 1. so it be serial 1 (original) serial 1(first duplicate) serial 1 (second duplicate).

an i just noticed something i was playing around with the example i gave you. An well i looked at what the value was before i deleted (the duplicate) and i looked at what the value was after i deleted (the duplicate) an it still said 2 even after i deleted when it should say one. Is it possible that the value could be causing it? here is the line for the value

Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
But here is a copy of the html i have right now

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

Expand|Select|Wrap|Line Numbers
  1. <!---Shows what was previously entered into serial and description table--->
  2.  
  3. <cfquery name="serial" datasource="CustomerSupport">
  4.         SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware,
  5.        resolution,resolution_date,verification_date,type_hardware_failure,
  6.         dept_responsibility,resolution_verified_by,fk_serialNo,fk_ticketNo,description
  7.         FROM dbo.tbl_CS_serial
  8.         LEFT JOIN dbo.tbl_CS_notes_descr
  9.         ON dbo.tbl_CS_serial.pkb_fk_ticketNo=dbo.tbl_CS_notes_descr.fk_ticketNo and
  10.         dbo.tbl_CS_serial.pka_serialNo=dbo.tbl_CS_notes_descr.fk_serialNo
  11.         WHERE pkb_fk_ticketNo = #URL.pk_ticketID# and fk_ticketNo = #URL.pk_ticketID#
  12.         ORDER BY pkb_fk_ticketNo
  13. </cfquery>
  14.  
  15. <!---Shows what was previously entered into parts table--->
  16. <cfquery name="parts" datasource="CustomerSupport">
  17.        SELECT pk_partID,fk_serialNo,fk_ticketNo,hc_partNo,ltrim(rtrim(part_returned)) as        part_returned,rma_number,defective
  18.          FROM dbo.tbl_CS_parts
  19.          WHERE fk_ticketNo = #URL.pk_ticketID#
  20. </cfquery>
Thank you,
Rach
Nov 10 '08 #221
bonneylake
769 512MB
Hey Acoder,

I know what the actual problem is! Your right it is the inserting more then once but its not with serial or parts. It turns out its with the one field called description (which has its own separate table ) is putting duplicates in its table!When i commented out the following lines. it did not insert duplicate. But when i had it uncommented it inserted duplicates.

here is where the problem lies
Expand|Select|Wrap|Line Numbers
  1. <!---Inserts information into notes_descr table.--->
  2. <!---<cfquery name="description" datasource="CustomerSupport">
  3.     exec usp_CS_Insertdescription
  4.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  5.    '#Form.pk_ticketID#',
  6.    <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
  7.    '#Form.fk_addedBy#'
  8. </cfquery>--->

here is what i have in full

Expand|Select|Wrap|Line Numbers
  1. <cftransaction>
  2. <!---Inserts information into serial table.--->
  3. <cfquery name="deleteserialparts" datasource="CustomerSupport">
  4. exec usp_CS_Deleteserialparts '#Form.pk_ticketID#'
  5. </cfquery>
  6.  
  7. <CFIF REQUEST_METHOD EQ "POST">
  8. <CFSET machineListLen = listLen(Form.serialcount)>
  9. <CFLOOP from="1" to="#machineListLen#" index="machineCount">
  10.  <CFSET serialnum       = Form["serialnum_" & machineCount]>
  11.  <CFSET modelno         = Form["modelno_" & machineCount]>
  12.  <CFSET producttype     = Form["producttype_" & machineCount]>
  13.  <CFSET softhardware    = Form["softhardware_" & machineCount]>
  14.  <CFSET resolution      = Form["resolution_" & machineCount]>
  15.  <CFSET resdate         = Form["resdate_" & machineCount]>
  16.  <CFSET resvertified    = Form["resvertified_" & machineCount]>
  17.  <CFSET vertifidate     = Form["vertifidate_" & machineCount]>
  18.  <CFSET deptvendor      = Form["deptvendor_" & machinecount]>
  19.  <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
  20. <CFSET thedescription  = Form["thedescription_" & machineCount]>
  21.  
  22.  
  23. <!--- inserts information into the serial table--->
  24. <cfquery name="serialinsertupdate" datasource="CustomerSupport">
  25.    exec usp_CS_Insertserial 
  26.      <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  27.      "#Form.pk_ticketID#",
  28.      <cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
  29.      <cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
  30.      <cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
  31.      <cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
  32.      <cfqueryparam value="#resdate#">,
  33.      <cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
  34.      <cfqueryparam value="#vertifidate#">,
  35.      <cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
  36.      <cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">   
  37.      </cfquery>
  38.  
  39. <!---Inserts information into notes_descr table.--->
  40. <!---<cfquery name="description" datasource="CustomerSupport">
  41.     exec usp_CS_Insertdescription
  42.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  43.    '#Form.pk_ticketID#',
  44.    <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
  45.    '#Form.fk_addedBy#'
  46. </cfquery>--->
  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['partscount' & 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_Insertparts 
  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>
  69. </cftransaction>
  70.  
Thank you,
Rach
Nov 10 '08 #222
acoder
16,027 Expert Mod 8TB
Excellent work (so far anyway)! At least you've found the problem spot. OK, can you show me the usp_CS_insertdescription query?
Nov 10 '08 #223
bonneylake
769 512MB
Excellent work (so far anyway)! At least you've found the problem spot. OK, can you show me the usp_CS_insertdescription query?
Hey Acoder,

yep sure can. But i do got a issue with the description. I am suppose to make it with the description where once a description is inserted it can not be edited. But they can view the descriptions that have been inserted. An they also have to be able to add descriptions. I was suppose to ask one of the other developers for help on this part since not sure how they wanted to do it. But wanted to bring this up because its pretty important.i was thinking of just making another page where they click on it an can view the descriptions but make it insert them the same way.but here is my stored procedure for the insert

Expand|Select|Wrap|Line Numbers
  1. set ANSI_NULLS ON
  2. set QUOTED_IDENTIFIER ON
  3. go
  4.  
  5.  
  6.  
  7. -- =============================================
  8. -- Author:        <Author,,Name>
  9. -- Create date: <Create Date,,>
  10. -- Description:    <Description,,>
  11. -- =============================================
  12. ALTER PROCEDURE [dbo].[usp_CS_Insertdescription] 
  13.     -- Add the parameters for the stored procedure here
  14.       (
  15.       @fk_serialNo nvarchar(50),
  16.       @fk_ticketNo numeric (18),
  17.       @description nvarchar(500),
  18.       @fk_addedBy nvarchar(100))
  19. AS
  20. BEGIN
  21.     -- SET NOCOUNT ON added to prevent extra result sets from
  22.     -- interfering with SELECT statements.
  23.     SET NOCOUNT ON;
  24.  
  25.     -- Insert statements for procedure here
  26.      insert into tbl_CS_notes_descr
  27.      (fk_serialNo,fk_ticketNo,description,fk_addedBy)
  28.  
  29.      values
  30.      (@fk_serialNo,@fk_ticketNo,@description,@fk_addedBy)          
  31.  
  32. END
  33.  
Thank you,
Rach
Nov 10 '08 #224
acoder
16,027 Expert Mod 8TB
I think it may be caused by the fact that the delete stored procedure doesn't delete descriptions. Also, now you mention that you can have many descriptions for one serial, it changes things. The serial query uses a join query to get the description. This assumes a one-to-one relationship, but now you've got a one-to-many relationship, i.e. many descriptions to one serial. You'll have to change the query to keep serials and descriptions separate like how you have serials and parts separate. In other words, treat descriptions like parts.
Nov 10 '08 #225
bonneylake
769 512MB
I think it may be caused by the fact that the delete stored procedure doesn't delete descriptions. Also, now you mention that you can have many descriptions for one serial, it changes things. The serial query uses a join query to get the description. This assumes a one-to-one relationship, but now you've got a one-to-many relationship, i.e. many descriptions to one serial. You'll have to change the query to keep serials and descriptions separate like how you have serials and parts separate. In other words, treat descriptions like parts.
Hey Acoder,

Alrighty i made the querys on the cticketpage2edit.cfm into this
Expand|Select|Wrap|Line Numbers
  1. <cfquery name="serial" datasource="CustomerSupport">
  2.         SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware,
  3.        resolution,resolution_date,verification_date,type_hardware_failure,
  4.         dept_responsibility,resolution_verified_by
  5.         FROM dbo.tbl_CS_serial
  6.         WHERE pkb_fk_ticketNo = #URL.pk_ticketID# 
  7. </cfquery>
  8.  
  9. <!---Shows what was previously entered into parts table--->
  10. <cfquery name="parts" datasource="CustomerSupport">
  11.        SELECT pk_partID,fk_serialNo,fk_ticketNo,hc_partNo,ltrim(rtrim(part_returned)) as        part_returned,rma_number,defective
  12.          FROM dbo.tbl_CS_parts
  13.          WHERE fk_ticketNo = #URL.pk_ticketID#
  14. </cfquery>
  15.  
  16. <!---Shows what was previously entered into description table--->
  17. <cfquery name="description" datasource="CustomerSupport">
  18.         SELECT fk_serialNo,fk_ticketNo,description
  19.          FROM dbo.tbl_CS_notes_descr
  20.          WHERE fk_ticketNo = #URL.pk_ticketID#
  21. </cfquery>
an well want to ask since if i am only inserting descriptions and going to be displaying them a different way. Unsure if i will be displaying them on the same page or a different page.but if i am displaying them on the page (i am doubting all do this) but in case i have to how would i just display it. I tried doing just this above the textarea.
Expand|Select|Wrap|Line Numbers
  1. <cfloop query="description">#description#</cfloop>
but i got the error of

Expression result cannot be converted to a string

Expressions used inside tags like CFOUTPUT, CFQUERY, CFMAIL, etc. must evaluate to a value that can be converted to a string for output or dynamic text accumulation purposes. Complex objects, such as queries, arrays, and COM/DCOM objects, cannot be represented as strings.


also wanted to ask would it be ok to go back to updating/inserting previously submitted serials and parts instead of deleting them? asking since inserting into serial and parts is not the problem and would be nice to be able to just update them instead. which i am sorry for making you go through all the deleting now, i wish i would of known what i do now back a week or 2 ago. i should of tested more, i should of thought about everything i had instead of just the javascript and html so i am sorry for putting you through all the extra work.

besides that i only have 2 problems left (as far as i know). For some reason when i update if i have a serial and part. When i come back to look it will not display the part anymore an only show a serial. The second problem i have is a similar problem with parts. If i add serials 1 and 3 and submit it i get the error of it asking for serial 2 an was wondering if we could make it where if a user does not submit a serial 2 it will still work ok.

Thank you,
Rach
Nov 10 '08 #226
acoder
16,027 Expert Mod 8TB
You'll have to move the description outside the serial table just as the parts is separate and have its own cfoutput loop.

The reason why the deletion was added was because of the problem where you can't insert and update at the same time. If you want to avoid deletes, you're going to have separate pages for inserts and updates.
Nov 10 '08 #227
bonneylake
769 512MB
You'll have to move the description outside the serial table just as the parts is separate and have its own cfoutput loop.

The reason why the deletion was added was because of the problem where you can't insert and update at the same time. If you want to avoid deletes, you're going to have separate pages for inserts and updates.
Hey Acoder,

Well the thing is though the description would have to appear where the description does now. An only way i can think of to do it as you described it would be to start off with cfoutput serial then stop it right where description starts, do my description an then restart serial again. An i don't know if that would work still the way it does now?

An actually i am able to update and insert at the same time using a stored procedure.I never had the problem of updating and inserting at the same time, just the problem with the duplicates. But I do it for my contacts table and i had created and tested it for my serials table and i doubled checked it just now and it works just fine with no errors and displays back on the edit page like it should.here is what i am using to update and insert at the same time.

Expand|Select|Wrap|Line Numbers
  1. set ANSI_NULLS ON
  2. set QUOTED_IDENTIFIER ON
  3. go
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17. -- =============================================
  18. -- Author:        <Author,,Name>
  19. -- Create date: <Create Date,,>
  20. -- Description:    <Description,,>
  21. -- =============================================
  22. ALTER PROCEDURE [dbo].[usp_CS_Updateinsertserial]
  23. -- Add the parameters for the stored procedure here
  24.     (@pka_serialNo nvarchar(100),
  25.     @pkb_fk_ticketNo nvarchar(100),
  26.     @model_no nvarchar(50),
  27.     @product_type nvarchar(100),
  28.     @software_hardware nvarchar(40),
  29.     @resolution nvarchar(500),
  30.     @resolution_date datetime,
  31.     @resolution_verified_by nvarchar(50),
  32.     @verification_date datetime,
  33.     @dept_responsibility nvarchar(50),
  34.     @type_hardware_failure nvarchar(100))
  35. AS
  36.  
  37. IF EXISTS(SELECT @pka_serialNo FROM dbo.tbl_CS_serial WHERE pka_serialNo=@pka_serialNo and pkb_fk_ticketNo=@pkb_fk_ticketNo)
  38.   BEGIN
  39.      UPDATE    dbo.tbl_CS_serial
  40.             SET       
  41.                       pkb_fk_ticketNo=@pkb_fk_ticketNo,
  42.                       model_no=@model_no,
  43.                       product_type=@product_type,
  44.                       software_hardware=@software_hardware,
  45.                       resolution=@resolution,
  46.                       resolution_date=@resolution_date,
  47.                       resolution_verified_by=@resolution_verified_by,
  48.                       verification_date=@verification_date,
  49.                       dept_responsibility=@dept_responsibility,
  50.                       type_hardware_failure=@type_hardware_failure
  51.  
  52.  
  53.             WHERE    (pka_serialNo=@pka_serialNo and pkb_fk_ticketNo=@pkb_fk_ticketNo)
  54.   END
  55. ELSE
  56.   BEGIN
  57. insert into dbo.tbl_CS_serial
  58.     (pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware,resolution,resolution_date,
  59.      resolution_verified_by,verification_date,dept_responsibility,type_hardware_failure)
  60.  
  61.     values  
  62.     (@pka_serialNo,@pkb_fk_ticketNo,@model_no,@product_type,@software_hardware,@resolution,@resolution_date,
  63.      @resolution_verified_by,@verification_date,@dept_responsibility,@type_hardware_failure)  
  64.     END
  65.  
but besides that i only got the other 2 problems i mentioned above the one with the parts not showing up after making changes to edit. an also the part about the serials where if i have serials 1, 3 it will say it needs serial 2.an i have also ran into this problem once again with the parts now with the new changes to the html.

Thank you,
Rach
Nov 10 '08 #228
acoder
16,027 Expert Mod 8TB
Well the thing is though the description would have to appear where the description does now. An only way i can think of to do it as you described it would be to start off with cfoutput serial then stop it right where description starts, do my description an then restart serial again. An i don't know if that would work still the way it does now?
In that case, use cfloop to output the description. Rename the description query to something else to avoid problems with Coldfusion trying to convert it to a string when you output #description#.
An actually i am able to update and insert at the same time using a stored procedure.I never had the problem of updating and inserting at the same time, just the problem with the duplicates. But I do it for my contacts table and i had created and tested it for my serials table and i doubled checked it just now and it works just fine with no errors and displays back on the edit page like it should.here is what i am using to update and insert at the same time.
I see. I didn't know you had this stored procedure. In that case, it could work without deletion.
but besides that i only got the other 2 problems i mentioned above the one with the parts not showing up after making changes to edit. an also the part about the serials where if i have serials 1, 3 it will say it needs serial 2.an i have also ran into this problem once again with the parts now with the new changes to the html.
We'll deal with these after the above two problems.
Nov 10 '08 #229
bonneylake
769 512MB
In that case, use cfloop to output the description. Rename the description query to something else to avoid problems with Coldfusion trying to convert it to a string when you output #description#.
I see. I didn't know you had this stored procedure. In that case, it could work without deletion.
We'll deal with these after the above two problems.
Hey Acoder,

Alrighty, i used the cfloop an well i am getting no errors, but its displaying what i wrote in every description for all descriptions. If i wrote for serial 1 the description test and wrote for serial 2 the description dog. When it redisplays it says testdog for both instead of serial 1 test and serial 2 dog.

an well i am working on the parts update and insert to make sure it will work with serial and parts together. i got it written. For some reason it don't want to give me the permissions to use it, but going to keep working on that.

Thank you,
Rach
Nov 10 '08 #230
acoder
16,027 Expert Mod 8TB
You need to have a separate description query for each serial just as parts has a separate query for each serial. Use the serialno field to get the right description for each serial.
Nov 10 '08 #231
bonneylake
769 512MB
You need to have a separate description query for each serial just as parts has a separate query for each serial. Use the serialno field to get the right description for each serial.
Hey Acoder,

Alrighty the update/insert for serial and parts is working perfectly and i am not having any trouble with that. I also have the description working perfectly as you said to do :). Ok so how do i go about fixing it so that if i entered serial 1,3 that it will not give me an error asking for 2? i am also having this same trouble once again with parts.

Here is the full html i have

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

That seemed to work perfectly for ignoring serials but still having issues with parts.I was also thinking, do i need to make this a update/insert and delete stored procedure since there will be serials/parts removed? Here is what i have for the submit
Expand|Select|Wrap|Line Numbers
  1. <cftransaction>
  2. <!---Inserts information into serial table.--->
  3. <!---<cfquery name="deleteserialparts" datasource="CustomerSupport">
  4. exec usp_CS_Deleteserialparts '#Form.pk_ticketID#'
  5. </cfquery>--->
  6.  
  7. <CFIF REQUEST_METHOD EQ "POST">
  8. <!---<CFSET machineListLen = listLen(Form.serialcount)>--->
  9. <CFLOOP list="#form.serialcount#" index="machineCount">
  10.  <CFSET serialnum       = Form["serialnum_" & machineCount]>
  11.  <CFSET modelno         = Form["modelno_" & machineCount]>
  12.  <CFSET producttype     = Form["producttype_" & machineCount]>
  13.  <CFSET softhardware    = Form["softhardware_" & machineCount]>
  14.  <CFSET resolution      = Form["resolution_" & machineCount]>
  15.  <CFSET resdate         = Form["resdate_" & machineCount]>
  16.  <CFSET resvertified    = Form["resvertified_" & machineCount]>
  17.  <CFSET vertifidate     = Form["vertifidate_" & machineCount]>
  18.  <CFSET deptvendor      = Form["deptvendor_" & machinecount]>
  19.  <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
  20. <CFSET thedescription  = Form["thedescription_" & machineCount]>
  21.  
  22.  
  23. <!--- inserts information into the serial table--->
  24. <cfquery name="serialinsertupdate" datasource="CustomerSupport">
  25.    exec usp_CS_Updateinsertserial 
  26.      <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  27.      "#Form.pk_ticketID#",
  28.      <cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
  29.      <cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
  30.      <cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
  31.      <cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
  32.      <cfqueryparam value="#resdate#">,
  33.      <cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
  34.      <cfqueryparam value="#vertifidate#">,
  35.      <cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
  36.      <cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">   
  37.      </cfquery>
  38.  
  39. <!---Inserts information into notes_descr table.--->
  40. <cfquery name="description" datasource="CustomerSupport">
  41.     exec usp_CS_Insertdescription
  42.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  43.    '#Form.pk_ticketID#',
  44.    <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
  45.    '#Form.fk_addedBy#'
  46. </cfquery>
  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['partscount' & 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_Updateinsertparts 
  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="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
  64.     <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
  65.  
  66. </cfquery>
  67. </cfloop>
  68. </CFLOOP>
  69. </CFIF>
Thank you,
Rach
Nov 10 '08 #234
acoder
16,027 Expert Mod 8TB
That seemed to work perfectly for ignoring serials but still having issues with parts.
Did you have this issue when you were deleting?
I was also thinking, do i need to make this a update/insert and delete stored procedure since there will be serials/parts removed?
This is what I forgot about when I looked at your insert-update stored procedure. I knew I was forgetting something - a good reason why the delete was there. You could combine all three (insert/update/delete), but it would mean some extra coding to get it to work. For example, you could store the deleted serials/parts numbers in a hidden field to use in the submitted page.
Nov 11 '08 #235
bonneylake
769 512MB
Hey Acoder,

With the parts i am not having trouble deleting them. It deletes fine. Its just when i go to insert its asking. For example

serial 1
parts 1
serial 2

if i do not add a parts 2 to the above example it asks me for it. It also happens if i do not have a parts 1 for serial 1.An if i do the exact example i have above i get the error

An error occurred while evaluating the expression:


"#form['partscount' & machinecount]#"


Error near line 91, column 20.
--------------------------------------------------------------------------------

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

an on the stored procedure not worried about the extra work. Just worried about making sure it don't delete all or delete ones that don't need to be deleted. Looking for an example online on how to add delete to the update insert i got now.

Thank you,
Rach
Nov 11 '08 #236
acoder
16,027 Expert Mod 8TB
If you don't have a part, use cfparam for defaulting to an empty string and if it's empty, don't loop.

Re. the stored procedure. You can avoid any more hidden fields by looping over the serials and when you come across a missing number, that serial has to be deleted. For example, you had 1, 2, 3, then 2 was deleted and 4 was added, so you have 1, 3, 4. When looping over the serialcount, when it comes across 3, 2 is missing, so you can delete 2. You don't necessarily need to combine it with the insert-update stored procedure because you can just call a separate stored procedure that just deletes.
Nov 11 '08 #237
bonneylake
769 512MB
Hey Acoder,

I am a bit confused about the parts part an unsure how i would do that. But i was thinking it might be a bit more simple.what we had done early with parts which was part2count and partscount worked perfectly before. An we have the same exact setup almost except that one hidden field appears in serial an the other appears in parts.is it possible that for the one that appears in parts that we could do what we had done before?which is this. but instead of using part2count use partscount?

Expand|Select|Wrap|Line Numbers
  1. <cfset partliststr = "">
  2. <cfloop from="1" to="#count1#" index="pl">
  3. <cfset partliststr = partliststr & #pl# & ",">
  4. </cfloop>
  5.  
  6. <input type="hidden" name="part2count#count#" id="part2count#count#" value="#partliststr#">

An also i think your right on the delete. When i added a part earlier an deleted it. Although it showed the part deleted in the html, in the partcounter it still displayed it as saying there was a part. For example if i added one part an partcounter value was 1. If i delete the part the value still says 1.

as with the sql query. Ok your idea sounds wonderful an was wondering how i could go about doing that? Could i still keep the same delete query i had previously and use that an just need to put a cfloop around the serial?

Thank you,
Rach
Nov 11 '08 #238
acoder
16,027 Expert Mod 8TB
For the parts, if you have no parts, the partscount fields will not be set. So just use cfparam above the loop to set it to "".
An also i think your right on the delete. When i added a part earlier an deleted it. Although it showed the part deleted in the html, in the partcounter it still displayed it as saying there was a part. For example if i added one part an partcounter value was 1. If i delete the part the value still says 1.
This is correct because you want unique values. The list length of partscount will give you the number of parts anyway.

as with the sql query. Ok your idea sounds wonderful an was wondering how i could go about doing that? Could i still keep the same delete query i had previously and use that an just need to put a cfloop around the serial?
You'll have to modify it to delete one serial at a time rather than all serials for a particular ticket. Use another variable which stores the current serial number. Match it with the serial number in the loop. If it doesn't match, then delete until it matches incrementing each time.
Nov 11 '08 #239
bonneylake
769 512MB
For the parts, if you have no parts, the partscount fields will not be set. So just use cfparam above the loop to set it to "".
This is correct because you want unique values. The list length of partscount will give you the number of parts anyway.

You'll have to modify it to delete one serial at a time rather than all serials for a particular ticket. Use another variable which stores the current serial number. Match it with the serial number in the loop. If it doesn't match, then delete until it matches incrementing each time.
Hey Acoder,

So do something like this for parts?

Expand|Select|Wrap|Line Numbers
  1. <cfparam name="form.partscount" default="">
  2. <cfloop list="#form['partscount' & machinecount]#" index="ps">
  3. <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
  4. <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
  5. <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
  6. <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
  7. <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
  8. <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
  9. <cfquery name="parts" datasource="CustomerSupport">
  10.     exec usp_CS_Updateinsertparts 
  11.     <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  12.     '#Form.pk_ticketID#',
  13.     <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
  14.     <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
  15.      <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
  16.     <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
  17.  
  18. </cfquery>
  19. </cfloop>
an then the delete for stored procedure has me a bit off. Are you saying to match the serial number with the ticket number to delete? or are you saying that in the cfloop on my userformedit.cfm page that i need to add it somewhere there to delete? here is what i have right now for the stored procedure delete

Expand|Select|Wrap|Line Numbers
  1. set ANSI_NULLS ON
  2. set QUOTED_IDENTIFIER ON
  3. go
  4.  
  5.  
  6.  
  7.  
  8.  
  9. -- =============================================
  10. -- Author:        <Author,,Name>
  11. -- Create date: <Create Date,,>
  12. -- Description:    <Description,,>
  13. -- =============================================
  14. ALTER PROCEDURE [dbo].[usp_CS_Deleteserialparts]
  15.     -- Add the parameters for the stored procedure here
  16.       (
  17.       @pka_serialNo nvarchar(100)
  18.       @pkb_fk_ticketNo nvarchar(100)) AS
  19.  
  20. DELETE FROM dbo.tbl_CS_serial where 
  21. (pka_serialNo = @pka_serialNo and pkb_fk_ticketNo = @pkb_fk_ticketNo)
Thank you,
Rach
Nov 11 '08 #240
acoder
16,027 Expert Mod 8TB
The partscount should be the full field name:
Expand|Select|Wrap|Line Numbers
  1. <cfparam name="form.partscount#machinecount#" default="">
Are you saying to match the serial number with the ticket number to delete? or are you saying that in the cfloop on my userformedit.cfm page that i need to add it somewhere there to delete?
For the matching, I mean something like:
Expand|Select|Wrap|Line Numbers
  1. <cfset currSerialNo = 1>
  2. <cfloop ...>
  3. <cfif ... --match currSerialNo with the serial count value 
  4.   <!--- then loop here till currSerialNo eq serial count --->
  5.   <cfloop ..
  6.     <!--- delete here --->
  7.     <! --- increment currSerialNo --->
  8.   </cfloop>
  9. </cfif>
Nov 11 '08 #241
bonneylake
769 512MB
Hey Acoder,

Alright i tried the parts an well i ran into a problem. Its adding the part to the wrong serial. heres the example i tried

this is what i resubmitted
serial 1
parts 1
serial 2
serial 3
parts 1

when went back to results it came back as

serial 1
parts 1
serial 2
parts 1
serial 3.

an then i tried the matching but i think i might of got a few things misplaced here is what i have

Expand|Select|Wrap|Line Numbers
  1. <CFIF REQUEST_METHOD EQ "POST">
  2. <!---<CFSET machineListLen = listLen(Form.serialcount)>--->
  3. <cfset currSerialNo = 1>
  4. <CFLOOP list="#form.serialcount#" index="machineCount">
  5. <cfif form.serialcount eq currSerialNo>
  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_Updateinsertserial 
  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. <cfparam name="form.partscount#machinecount#" default="">
  47. <cfloop list="#form['partscount' & machinecount]#" index="ps">
  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_Updateinsertparts 
  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="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
  61.     <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
  62.  
  63. </cfquery>
  64. </cfloop>
  65. </CFLOOP>
  66. <cfloop>
  67. <cfquery name="deleteserialparts" datasource="CustomerSupport">
  68. exec usp_CS_Deleteserialparts '#Form.pk_ticketID#'
  69. </cfquery>
  70. </cfif>
  71. </CFIF>
Thank you,
Rach
Nov 11 '08 #242
acoder
16,027 Expert Mod 8TB
Why have you got an opening cfloop and a delete query at the bottom (lines 66-69)?

For the parts, check the partscount values for partscount1, partscount2, partscount3. They should be "1", "" and "1" respectively for that example.

The matching is incorrect, It should be against machinecount, and it's not complete. See the general idea in my previous post.
Nov 12 '08 #243
bonneylake
769 512MB
Hey Acoder,

are you meaning something like this

Expand|Select|Wrap|Line Numbers
  1. <CFIF REQUEST_METHOD EQ "POST">
  2.  <!---<CFSET machineListLen = listLen(Form.serialcount)>--->
  3.  <cfset currSerialNo = 1>
  4.  <CFLOOP list="#form.serialcount#" index="machineCount">
  5. <cfif machineCount eq currSerialNo>
  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_Updateinsertserial 
  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.  <cfparam name="form.partscount#machinecount#" default="">
  47.  <cfloop list="#form['partscount' & machinecount]#" index="ps">
  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_Updateinsertparts 
  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="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
  61.    <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
  62.  
  63.  </cfquery> 
  64.  <cfquery name="deleteserialparts" datasource="CustomerSupport">
  65.  exec usp_CS_Deleteserialparts '#Form.pk_ticketID#'
  66.  </cfquery>
  67.  <cfset currSerialNo = currSerialNo + 1>
  68. </cfloop>
  69. </cfif>
  70. </CFLOOP>
  71.  </CFIF>
an then with the parts part i am completely confused on what you mean to do.

i went an redid the examples this is what i have before i submit. for some reason i have no partscount for dynamic2input

Expand|Select|Wrap|Line Numbers
  1. for dynamic1input
  2. <input id="partcounter1" type="hidden" value="1" name="partcounter1"/>
  3. <input id="partscount1" type="hidden" value="1" name="partscount1"/>
  4.  
  5. for dynamic2input
  6. <input id="partcounter2" type="hidden" value="0" name="partcounter2"/>
  7.  
  8. for dynamic3input
  9. <input id="partcounter3" type="hidden" value="1" name="partcounter3"/>
  10. <input type="hidden" value="1" name="partscount3"/>
  11.  
Thank you,
Rach
Nov 12 '08 #244
acoder
16,027 Expert Mod 8TB
You're missing out the extra loop that you need to add:
Expand|Select|Wrap|Line Numbers
  1. <cfloop <!--- loop until currSerialNo eq machinecount --->
  2.      <!--- delete here by calling stored procedure --->
  3.      <! --- increment currSerialNo --->
  4.    </cfloop>
Of course, you need to replace the comments with actual code.

The second dynamic2input having no partscount is correct because there are no parts.
Nov 12 '08 #245
bonneylake
769 512MB
Hey Acoder,

would the cfloop i used below work, and is it in the correct place?

Expand|Select|Wrap|Line Numbers
  1.  
  2. <CFIF REQUEST_METHOD EQ "POST">
  3.  <!---<CFSET machineListLen = listLen(Form.serialcount)>--->
  4.  <cfset currSerialNo = 1>
  5.  <CFLOOP list="#form.serialcount#" index="machineCount">
  6. <cfif machineCount eq currSerialNo>
  7.  <CFSET serialnum       = Form["serialnum_" & machineCount]>
  8.   <CFSET modelno         = Form["modelno_" & machineCount]>
  9.   <CFSET producttype     = Form["producttype_" & machineCount]>
  10.  <CFSET softhardware    = Form["softhardware_" & machineCount]>
  11.   <CFSET resolution      = Form["resolution_" & machineCount]>
  12.   <CFSET resdate         = Form["resdate_" & machineCount]>
  13.   <CFSET resvertified    = Form["resvertified_" & machineCount]>
  14. <CFSET vertifidate     = Form["vertifidate_" & machineCount]>
  15. <CFSET deptvendor      = Form["deptvendor_" & machinecount]>
  16.  <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
  17.  <CFSET thedescription  = Form["thedescription_" & machineCount]>
  18.  
  19.  
  20.  <!--- inserts information into the serial table--->
  21.  <cfquery name="serialinsertupdate" datasource="CustomerSupport">
  22.     exec usp_CS_Updateinsertserial 
  23.      <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  24.      "#Form.pk_ticketID#",
  25.      <cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
  26.       <cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
  27.      <cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
  28.      <cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
  29.      <cfqueryparam value="#resdate#">,
  30.      <cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
  31.      <cfqueryparam value="#vertifidate#">,
  32.     <cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
  33.      <cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">   
  34.      </cfquery>
  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.   <!---Inserts parts information into parts table.--->
  46.   <!---because it is a bit we don't use 'ticks' around defective for parts table--->
  47.  <cfparam name="form.partcounter#machinecount#" default="">
  48.  <cfloop list="#form['partscount' & machinecount]#" index="ps">
  49. <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
  50.   <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
  51.  <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
  52.  <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
  53.  <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
  54.  <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
  55. <cfquery name="parts" datasource="CustomerSupport">
  56.    exec usp_CS_Updateinsertparts 
  57.   <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  58.    '#Form.pk_ticketID#',
  59.     <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
  60.     <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
  61.     <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
  62.    <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
  63.  
  64.  </cfquery> 
  65.  <cfloop condition="currSerialNo eq machinecount">
  66.  <cfquery name="deleteserialparts" datasource="CustomerSupport">
  67.  exec usp_CS_Deleteserialparts '#Form.pk_ticketID#'
  68.  </cfquery>
  69.  <cfset currSerialNo = currSerialNo + 1>
  70.  </cfloop>
  71. </cfloop>
  72. </CFLOOP>
  73.  </CFIF>
  74.  
  75.  
an then if parts is working correctly then what do i need to do to it to make the part go with the correct serial? because right now if i submit it as so

serial 1
part 1 for serial 1
serial 2
serial 3
part 1 for serial 3

instead of the part 1 being with serial 3 it puts it with serial 2.

Thank you,
Rach
Nov 12 '08 #246
acoder
16,027 Expert Mod 8TB
Trying to get two things working at once is always going to be difficult especially if one can affect the other.

Try to get one thing working first. First, let's work on the deletion. Move the loop all the way up to the top of the serial loop. Also, the stored procedure called for deletion must only delete one serial at a time, not all serials for that ticket (so you may need to create a new stored procedure).
Nov 12 '08 #247
bonneylake
769 512MB
Trying to get two things working at once is always going to be difficult especially if one can affect the other.

Try to get one thing working first. First, let's work on the deletion. Move the loop all the way up to the top of the serial loop. Also, the stored procedure called for deletion must only delete one serial at a time, not all serials for that ticket (so you may need to create a new stored procedure).
Hey Acoder,

Here is what i have now
Expand|Select|Wrap|Line Numbers
  1. <CFIF REQUEST_METHOD EQ "POST">
  2.  <!---<CFSET machineListLen = listLen(Form.serialcount)>--->
  3.  <cfset currSerialNo = 1>
  4.   <cfloop condition="currSerialNo eq machinecount">
  5.  <cfquery name="deleteserialparts" datasource="CustomerSupport">
  6.  exec usp_CS_Deleteserialparts '#Form.pk_ticketID#'
  7.  </cfquery>
  8.  <cfset currSerialNo = currSerialNo + 1>
  9.  </cfloop>
  10.  <CFLOOP list="#form.serialcount#" index="machineCount">
  11. <cfif machineCount eq currSerialNo>
  12.  <CFSET serialnum       = Form["serialnum_" & machineCount]>
  13.   <CFSET modelno         = Form["modelno_" & machineCount]>
  14.   <CFSET producttype     = Form["producttype_" & machineCount]>
  15.  <CFSET softhardware    = Form["softhardware_" & machineCount]>
  16.   <CFSET resolution      = Form["resolution_" & machineCount]>
  17.   <CFSET resdate         = Form["resdate_" & machineCount]>
  18.   <CFSET resvertified    = Form["resvertified_" & machineCount]>
  19. <CFSET vertifidate     = Form["vertifidate_" & machineCount]>
  20. <CFSET deptvendor      = Form["deptvendor_" & machinecount]>
  21.  <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
  22.  <CFSET thedescription  = Form["thedescription_" & machineCount]>
  23.  
  24.  
  25.  <!--- inserts information into the serial table--->
  26.  <cfquery name="serialinsertupdate" datasource="CustomerSupport">
  27.     exec usp_CS_Updateinsertserial 
  28.      <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  29.      "#Form.pk_ticketID#",
  30.      <cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
  31.       <cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
  32.      <cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
  33.      <cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
  34.      <cfqueryparam value="#resdate#">,
  35.      <cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
  36.      <cfqueryparam value="#vertifidate#">,
  37.     <cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
  38.      <cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">   
  39.      </cfquery>
  40.  
  41.  <!---Inserts information into notes_descr table.--->
  42.  <cfquery name="description" datasource="CustomerSupport">
  43.     exec usp_CS_Insertdescription
  44.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  45.    '#Form.pk_ticketID#',
  46.     <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
  47.    '#Form.fk_addedBy#'
  48.  </cfquery>
  49.  
  50.   <!---Inserts parts information into parts table.--->
  51.   <!---because it is a bit we don't use 'ticks' around defective for parts table--->
  52.  <cfparam name="form.partcounter#machinecount#" default="">
  53.  <cfloop list="#form['partscount' & machinecount]#" index="ps">
  54. <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
  55.   <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
  56.  <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
  57.  <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
  58.  <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
  59.  <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
  60. <cfquery name="parts" datasource="CustomerSupport">
  61.    exec usp_CS_Updateinsertparts 
  62.   <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  63.    '#Form.pk_ticketID#',
  64.     <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
  65.     <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
  66.     <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
  67.    <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
  68.  
  69.  </cfquery> 
  70.  
  71. </cfloop>
  72. </CFLOOP>
  73.  </CFIF>
and with the stored procedure how would i make it delete based on one serial at a time?

Thank you,
Rach
Nov 12 '08 #248
acoder
16,027 Expert Mod 8TB
I meant the top of the loop, i.e. inside it not above it.

For the stored procedure, you'd need to pass the ticket id and serial no, then in the stored proc. delete from the serial table where the inputs match (probably similar to what you have now and I vaguely remember you having one that worked earlier). Note that you wouldn't need to do any of this if you just deleted everything at the top and then started afresh with the inserts, but you wanted to avoid that.
Nov 12 '08 #249
bonneylake
769 512MB
I meant the top of the loop, i.e. inside it not above it.

For the stored procedure, you'd need to pass the ticket id and serial no, then in the stored proc. delete from the serial table where the inputs match (probably similar to what you have now and I vaguely remember you having one that worked earlier). Note that you wouldn't need to do any of this if you just deleted everything at the top and then started afresh with the inserts, but you wanted to avoid that.
Hey Acoder,

Ok so would this be right or does this need to be under the cfset or the cfquery for the serialinsetupdate?

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

and here is what i had previously for the stored procedure. But just not sure how to do the part where you said delete from the serial table where the inputs match . are you meaning when serial and the ticket number match?


Expand|Select|Wrap|Line Numbers
  1.    1. set ANSI_NULLS ON
  2.    2. set QUOTED_IDENTIFIER ON
  3.    3. go
  4.    4.  
  5.    5.  
  6.    6.  
  7.    7.  
  8.    8.  
  9.    9. -- =============================================
  10.   10. -- Author:        <Author,,Name>
  11.   11. -- Create date: <Create Date,,>
  12.   12. -- Description:    <Description,,>
  13.   13. -- =============================================
  14.   14. ALTER PROCEDURE [dbo].[usp_CS_Deleteserialparts]
  15.   15.     -- Add the parameters for the stored procedure here
  16.   16.       (
  17.   17.       @pka_serialNo nvarchar(100)
  18.   18.       @pkb_fk_ticketNo nvarchar(100)) AS
  19.   19.  
  20.   20. DELETE FROM dbo.tbl_CS_serial where 
  21.   21. (pka_serialNo = @pka_serialNo and pkb_fk_ticketNo = @pkb_fk_ticketNo)
Thank you,
Rach
Nov 12 '08 #250

Post your reply

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

Similar topics

4 posts views Thread by Vigneshwar Pilli via DotNetMonster.com | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.