469,301 Members | 2,272 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,301 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 24514
acoder
16,027 Expert Mod 8TB
It depends on what version of SQL Server you're using. If it's 2000 and later it's very easy - just add a constraint. This article may help. If you need more help on this, I suggest you ask in the SQL Server forum. Once you have it working, you can come back to this thread.
Oct 29 '08 #151
bonneylake
769 512MB
It depends on what version of SQL Server you're using. If it's 2000 and later it's very easy - just add a constraint. This article may help. If you need more help on this, I suggest you ask in the SQL Server forum. Once you have it working, you can come back to this thread.
Hey Acoder,

I am using SQL server 2005. But i am still baffled by the example. The reason i am confused is my tables are not related, they are 2 different separate things so i am not sure how to do it if both tables are not related? but i posted a question on it here http://bytes.com/forum/showthread.ph...89#post3405289

Thank you,
Rach
Oct 29 '08 #152
bonneylake
769 512MB
Hey Acoder,

I wanted to ask if i went back to just looping the coldfusion what sort of performance issues could i run into? reason i am asking is because i am starting
to debate if the delete cascade is going to work on my 2 tables. Also, i thought about it over the weekend and a concern came up i wanted to ask you on. Although are internet is fast where i work most of the time, we do have issues that come up at least once a month where the internet will just die.No warning or anything. An i am wondering what could/would happen if someone was submitting the serials but as they went to submit an they where suppose to be took to the next page and instead of being took to the next page the internet cut out, would all the fields delete an no new ones be added, or would the delete never happen? been thinking about it over the weekend an wanted to ask because if there is the chance of loosing it i must admit that concerns me. Its ok if it remains old information an doesn't update (they can go back an update again later). But if theres no information to update then that could be a serious problem.

Thank you,
Rach
Nov 3 '08 #153
acoder
16,027 Expert Mod 8TB
It depends on when it exactly happens, but there's an easy solution. Use cftransaction to make sure it all happens as one transaction.
Nov 3 '08 #154
bonneylake
769 512MB
It depends on when it exactly happens, but there's an easy solution. Use cftransaction to make sure it all happens as one transaction.
Hey Acoder,

Well everything gets inserted into the table after everything has been filled out in the entire form an the user clicks submit. So basically instead of <cfquery name = "" datasource="" i would do something like <cftransaction name="" datasource"" to prevent the problem ?

Thank you,
Rach
Nov 3 '08 #155
acoder
16,027 Expert Mod 8TB
No, the cftransaction tag would encapsulate all the cfquerys. Read the docs on the tag.
Nov 3 '08 #156
bonneylake
769 512MB
No, the cftransaction tag would encapsulate all the cfquerys. Read the docs on the tag.
Hey Acoder,

I see what your saying so something like

Expand|Select|Wrap|Line Numbers
  1. <cftransaction>
  2. <cfquery name="serialinsertupdate" datasource="CustomerSupport">
  3.    exec usp_CS_Updateserial 
  4. the fields
  5.      </cfquery>
  6. </cftransaction>
an wanted to ask they had an option where you could add an action to the
cf transaction an was wondering if i needed to add one an if i do which one? an also if i have more the one cfquery on the page where it submits, should i wrap the cftransaction around all the cfquerys present or only the cfquerys i am worried about?

Thank you,
Rach
Nov 3 '08 #157
acoder
16,027 Expert Mod 8TB
I think the default options should be OK. It should go around the queries you're worried about. In other words, if it were to crash/lose connection/break down during the running of the queries within cftransaction, there's nothing to worry about. It's either all of them or none.
Nov 3 '08 #158
bonneylake
769 512MB
I think the default options should be OK. It should go around the queries you're worried about. In other words, if it were to crash/lose connection/break down during the running of the queries within cftransaction, there's nothing to worry about. It's either all of them or none.
Hey Acoder,

Well i am glade my concern was only a small fix :). But alrighty so we got the stored procedure for the delete, so were do we go next?

this is the last thing i had on the user form page (before working on the stored procedure). where everything gets sent to the database after editing.

Expand|Select|Wrap|Line Numbers
  1. <cftransaction>
  2. <!---Inserts information into serial table.--->
  3.  
  4. <CFIF REQUEST_METHOD EQ "POST">
  5. <CFSET machineListLen = listLen(Form.serialcount)>
  6. <CFLOOP from="1" to="#machineListLen#" index="machineCount">
  7. <cfloop>
  8.  <CFSET serialnum       = Form["serialnum_" & machineCount]>
  9.  <CFSET modelno         = Form["modelno_" & machineCount]>
  10.  <CFSET producttype     = Form["producttype_" & machineCount]>
  11.  <CFSET softhardware    = Form["softhardware_" & machineCount]>
  12.  <CFSET resolution      = Form["resolution_" & machineCount]>
  13.  <CFSET resdate         = Form["resdate_" & machineCount]>
  14.  <CFSET resvertified    = Form["resvertified_" & machineCount]>
  15.  <CFSET vertifidate     = Form["vertifidate_" & machineCount]>
  16.  <CFSET deptvendor      = Form["deptvendor_" & machinecount]>
  17.  <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
  18. <CFSET thedescription  = Form["thedescription_" & machineCount]>
  19.  
  20.  
  21. <!--- inserts information into the serial table--->
  22. <cfquery name="serialinsertupdate" datasource="CustomerSupport">
  23.    exec usp_CS_Updateserial 
  24.      <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  25.      "#Form.pk_ticketID#",
  26.      <cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
  27.      <cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
  28.      <cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
  29.      <cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
  30.      <cfqueryparam value="#resdate#">,
  31.      <cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
  32.      <cfqueryparam value="#vertifidate#">,
  33.      <cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
  34.      <cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">   
  35.      </cfquery>
  36.  
  37. <!---Inserts information into notes_descr table.--->
  38. <cfquery name="description" datasource="CustomerSupport">
  39.     exec usp_CS_Insertdescription
  40.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  41.    '#Form.pk_ticketID#',
  42.    <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
  43.    '#Form.fk_addedBy#'
  44. </cfquery>
  45.  
  46. <!---Inserts parts information into parts table.--->
  47. <!---because it is a bit we don't use 'ticks' around defective for parts table--->
  48. <cfloop list="#form['part2count' & machinecount]#" index="ps">
  49. <cfloop>
  50. <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
  51. <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
  52. <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
  53. <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
  54. <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
  55. <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
  56. <cfquery name="parts" datasource="CustomerSupport">
  57.     exec usp_CS_Updateparts 
  58.     <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  59.     '#Form.pk_ticketID#',
  60.     <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
  61.     <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
  62.     <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">,
  63.     <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">
  64. </cfquery>
  65. </cfloop>
  66. </cfloop>
  67. </cfloop>
  68. </CFLOOP>
  69. </CFIF>
  70. </cftransaction>
  71.  
Thank you,
Rach
Nov 3 '08 #159
acoder
16,027 Expert Mod 8TB
You need to add a call to the delete stored procedure at the top within the cftransaction. I'm thinking that if this is the only place this stored procedure is used, you could modify it to delete by ticket, so you wouldn't have to call it repeatedly for all serials.
Nov 3 '08 #160
bonneylake
769 512MB
You need to add a call to the delete stored procedure at the top within the cftransaction. I'm thinking that if this is the only place this stored procedure is used, you could modify it to delete by ticket, so you wouldn't have to call it repeatedly for all serials.
Hey Acoder,

Are you saying call it by using a cfquery like so? or is there another way to call it for a delete?

Expand|Select|Wrap|Line Numbers
  1. <cftransaction>
  2. <!---Inserts information into serial table.--->
  3. <cfquery name="deleteserialparts" datasource="CustomerSupport">
  4. exec usp_CS_Deleteserialparts
  5. </cfquery>
  6.  
  7. <CFIF REQUEST_METHOD EQ "POST">
Thank you,
Rach
Nov 3 '08 #161
acoder
16,027 Expert Mod 8TB
The stored proc. requires two parameters, serial no and ticket no. I was suggesting that you modify the stored procedure to delete by ticket, so it gets all serials matching that ticket no. and deletes them (and the cascade would delete all parts too). Of course, you could do this via Coldfusion by using a select query first and then looping over the results to delete each serial one by one, but doing it all in one go via a single stored procedure call would be more efficient.
Nov 4 '08 #162
bonneylake
769 512MB
The stored proc. requires two parameters, serial no and ticket no. I was suggesting that you modify the stored procedure to delete by ticket, so it gets all serials matching that ticket no. and deletes them (and the cascade would delete all parts too). Of course, you could do this via Coldfusion by using a select query first and then looping over the results to delete each serial one by one, but doing it all in one go via a single stored procedure call would be more efficient.
Hey Acoder,

So your basically saying to do something like this in the stored procedure to delete just based on ticket number?

Expand|Select|Wrap|Line Numbers
  1. set ANSI_NULLS ON
  2. set QUOTED_IDENTIFIER ON
  3. go
  4.  
  5.  
  6.  
  7.  
  8. -- =============================================
  9. -- Author:        <Author,,Name>
  10. -- Create date: <Create Date,,>
  11. -- Description:    <Description,,>
  12. -- =============================================
  13. ALTER PROCEDURE [dbo].[usp_CS_Deleteserialparts]
  14.     -- Add the parameters for the stored procedure here
  15.       (@pkb_fk_ticketNo nvarchar(100)) AS
  16.  
  17. DELETE FROM dbo.tbl_CS_serial where pkb_fk_ticketNo = @pkb_fk_ticketNo
Thank you,
Rach
Nov 4 '08 #163
acoder
16,027 Expert Mod 8TB
Well, if that works, then yes. Test it out with a few serials, i.e. add 3 serials for a particular ticket, say no. 3, with some parts too for those serials, then try this stored procedure with '3' supplied to it.
Nov 4 '08 #164
bonneylake
769 512MB
Hey Acoder,

Yep that worked perfectly :), So whats next?

Thank you,
Rach
Nov 4 '08 #165
acoder
16,027 Expert Mod 8TB
In your code in #161, just add the ticket no. I can't recall now, but I think that it was passed via the URL.
Nov 4 '08 #166
bonneylake
769 512MB
In your code in #161, just add the ticket no. I can't recall now, but I think that it was passed via the URL.
Hey Acoder,

Here is what i have in full. An when the user opens up a ticket an when a user goes to the second page it gets passed via URL. but when they finally submit it (like we are doing) it don't get passed by URL it just submits.

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. <cfloop>
  11.  <CFSET serialnum       = Form["serialnum_" & machineCount]>
  12.  <CFSET modelno         = Form["modelno_" & machineCount]>
  13.  <CFSET producttype     = Form["producttype_" & machineCount]>
  14.  <CFSET softhardware    = Form["softhardware_" & machineCount]>
  15.  <CFSET resolution      = Form["resolution_" & machineCount]>
  16.  <CFSET resdate         = Form["resdate_" & machineCount]>
  17.  <CFSET resvertified    = Form["resvertified_" & machineCount]>
  18.  <CFSET vertifidate     = Form["vertifidate_" & machineCount]>
  19.  <CFSET deptvendor      = Form["deptvendor_" & machinecount]>
  20.  <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
  21. <CFSET thedescription  = Form["thedescription_" & machineCount]>
  22.  
  23.  
  24. <!--- inserts information into the serial table--->
  25. <cfquery name="serialinsertupdate" datasource="CustomerSupport">
  26.    exec usp_CS_Updateserial 
  27.      <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  28.      "#Form.pk_ticketID#",
  29.      <cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
  30.      <cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
  31.      <cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
  32.      <cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
  33.      <cfqueryparam value="#resdate#">,
  34.      <cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
  35.      <cfqueryparam value="#vertifidate#">,
  36.      <cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
  37.      <cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">   
  38.      </cfquery>
  39.  
  40. <!---Inserts information into notes_descr table.--->
  41. <cfquery name="description" datasource="CustomerSupport">
  42.     exec usp_CS_Insertdescription
  43.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  44.    '#Form.pk_ticketID#',
  45.    <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
  46.    '#Form.fk_addedBy#'
  47. </cfquery>
  48.  
  49. <!---Inserts parts information into parts table.--->
  50. <!---because it is a bit we don't use 'ticks' around defective for parts table--->
  51. <cfloop list="#form['part2count' & machinecount]#" index="ps">
  52. <cfloop>
  53. <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
  54. <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
  55. <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
  56. <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
  57. <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
  58. <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
  59. <cfquery name="parts" datasource="CustomerSupport">
  60.     exec usp_CS_Updateparts 
  61.     <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  62.     '#Form.pk_ticketID#',
  63.     <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
  64.     <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
  65.     <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">,
  66.     <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">
  67. </cfquery>
  68. </cfloop>
  69. </cfloop>
  70. </cfloop>
  71. </CFLOOP>
  72. </CFIF>
  73.  
Thank you,
Rach
Nov 4 '08 #167
acoder
16,027 Expert Mod 8TB
That looks right. Did you test it?
Nov 4 '08 #168
bonneylake
769 512MB
That looks right. Did you test it?
Hey Acoder,

I tested it, an it deleted, but it did not reinsert the information into the table. I had to delete the 2 extra cfloops i had in there cause it was causing trouble beyond that i still have the same thing.

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_Updateserial 
  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['part2count' & machinecount]#" index="ps">
  51. <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
  52. <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
  53. <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
  54. <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
  55. <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
  56. <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
  57. <cfquery name="parts" datasource="CustomerSupport">
  58.     exec usp_CS_Updateparts 
  59.     <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  60.     '#Form.pk_ticketID#',
  61.     <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
  62.     <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
  63.     <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">,
  64.     <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">
  65. </cfquery>
  66. </cfloop>
  67. </CFLOOP>
  68. </CFIF>
Thank you,
Rach
Nov 4 '08 #169
acoder
16,027 Expert Mod 8TB
Yeah, you had some extra cfloop tags.

Have you checked what's being passed from the client-side? Does it flag up any errors?
Nov 4 '08 #170
bonneylake
769 512MB
Yeah, you had some extra cfloop tags.

Have you checked what's being passed from the client-side? Does it flag up any errors?
Hey Acoder,

I figured it out, i needed to change the exec from updating to insert, so now its inserting it. But sadly i am still having the same trouble i had before. After i made the change an went to edit its still showing duplicate entries although in the table itself it only shows the serials i insert once. An like before its only putting duplicates of previously submitted serials. The new one i inserted (to try the change out) did not insert another one only the previous serial i had before.
But i think i know where the problem is. I started taking out things an well i been thinking the whole time it was the javascript doing it, an so i took out all the javascript at the top that allows users to add serials and parts. an well i went and made changes to one serial and resubmitted it an went back to edit it an it only showed that one serial! so i think the javascript is causing it, but i have no clue where it is causing it. Here is what i have for the javascript on this page.


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

At least the inserting is now working, so it's just the displaying which is causing problems. Look at the Coldfusion code which generates the HTML
Nov 4 '08 #172
bonneylake
769 512MB
It won't be the JavaScript which is causing it because the JavaScript only adds when you call it unless you are calling addInput when the page loads.

At least the inserting is now working, so it's just the displaying which is causing problems. Look at the Coldfusion code which generates the HTML
Hey Acoder,

The only way it can call addInput would be something like for example body onload="dynamicInput" correct? i did have that at one point but not anymore so i don't think i am calling it but it only happens when i go back an look at that page. Like it is not inserting duplicate records in the database (never was) it only redisplays duplicates when i get to the cticketpage2edit.cfm page where it shows the previously submitted records for serial and parts.

An i am confused on the coldfusion code which generates the html? are you talking about the coldfusion querys where it shows the results? or are you talking about the html code that appears inbetween the divs?

Thank you,
Rach
Nov 4 '08 #173
acoder
16,027 Expert Mod 8TB
I mean the code which generates the HTML displaying the serials and parts.

When you say go back, do you mean pressing the back button or do you mean clicking a link to go back to another page? Can you show the relevant able displaying code from cticketpage2edit.cfm.
Nov 4 '08 #174
bonneylake
769 512MB
I mean the code which generates the HTML displaying the serials and parts.

When you say go back, do you mean pressing the back button or do you mean clicking a link to go back to another page? Can you show the relevant able displaying code from cticketpage2edit.cfm.
Hey Acoder,

I mean when i click the link to go to another page. However, the thing is it will only show the duplicate if i click the final submit. If i am on cticketpage2edit and close it out an go to relook at it, it doesn't insert the duplicate. Just when i click that final submit button. An like i said when i took out all the javascript at the top, it didn't show a duplicate when i clicked on that final submit button and viewed the information again. but here is what i have inbetween the div's that display the previously entered information

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

What serialdisplay.cfm and partsdisplay.cfm do is when a field or fields are not entered what it does is display those fields because before if a field was not enetered it would not display the field at all.This would happen if a serial or parts section was not filled out an then it happened only to certain fields, especially text input fields. But i know if this could be the problem considering i have commented out the lines that have anything to do with those 2 files an the problem still happened.. But Here is what i have in both files

serialdisplay.cfm
Expand|Select|Wrap|Line Numbers
  1. <!---IF HAVE ANY BLANKS IN ANY FIELDS THIS MAKES IT SO THE FIELD WILL SHOW UP--->
  2.  
  3. <cfif serial.recordcount is 0>  
  4. <cfset count = 0>
  5. <cfset count = count + 1>
  6. <cfoutput>
  7. <div id="dynamic#count#Input">
  8. <table class="zpExpandedTable" id="modeltable"> 
  9. <th class="sectiontitletick" colspan="7">
  10. Serial Information #count# </th>
  11. <tr>
  12. <td id="paddingformultitop">Model No:&nbsp;&nbsp;&nbsp;&nbsp;</td>
  13. </td>
  14. <td>
  15. <select name="modelno_#count#">
  16. <option value="">Make A Selection</option>
  17. <cfloop query="models">
  18. <option value="#model#">#model#</option>
  19.  
  20. </cfloop> 
  21. </select>
  22.  
  23. </td>
  24. <td>
  25. &nbsp;&nbsp;&nbsp;&nbsp;Product Type:
  26. </td>
  27. <td>
  28. <select name="producttype_#count#">
  29. <option value="" selected>No Choice</option>
  30. <cfloop query="getProdType">
  31. <option value="#pk_productType#">#pk_productType#</option> 
  32. </cfloop>
  33. </select>
  34. </td>
  35. <td class="red'">
  36. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type Of Hardware Failure*:
  37. </td>
  38. <td>
  39. <select name="hardwarefailure_#count#">
  40. <option value="" selected>Make A Selection</option>
  41. <cfloop query="getHardwareFail">
  42. <option value="#pk_hardwareFailure#">#pk_hardwareFailure#</option>
  43. </cfloop>
  44. </select>
  45. </td>
  46. </tr>
  47. <table>
  48.  
  49. <!--- Shows what was previously entered for Serial Number and Software/Hardware  --->
  50. <table class="zpExpandedTable" id="modeltable">
  51. <tr>
  52. <td id="paddingformultitop">
  53. Serial Number:&nbsp;&nbsp;
  54. <input type="text" name="serialnum_#count#" value="">
  55. &nbsp;&nbsp;&nbsp;&nbsp;Software/Hardware:&nbsp;&nbsp;
  56. <select name="softhardware_#count#">
  57. <option value="" selected>No Choice</option>
  58. <cfloop query="getSoftHard">
  59. <option value="#pk_softwareHardware#">#pk_softwareHardware#</option>
  60. </cfloop>
  61. </select>
  62. </td>
  63. </tr>
  64. </table>
  65.  
  66. <!--- Shows what was previously entered for Description ---> 
  67.  
  68. <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
  69. <tr>
  70. <td id="paddingformutli">
  71. Description:&nbsp;&nbsp;
  72. </td>
  73. <td class="descriptionmoveinmulti">
  74. ( You may enter up to 1000 characters. )
  75. <br>
  76. <textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name="thedescription_#count#"></textarea>
  77. </td>
  78. </tr>
  79. </table>
  80.  
  81. <!---Shows what was previously entered for Resolution  --->
  82.  
  83. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  84. <tr>
  85. <td id="paddingformutli">
  86. Resolution:&nbsp;&nbsp;
  87. </td>
  88. <td class="resolutionmoveinmulti">
  89. ( You may enter up to 1500 characters. )
  90. <br>
  91. <textarea maxlength='1500' onkeyup='return resolutionmaxlength(this)' onkeydown='return resolutionmaxlength(this)' rows='4' cols='60' name="resolution_#count#"></textarea>
  92. </td>
  93. </tr>
  94. </table>
  95.  
  96. <!--- Shows what was previously entered for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by  --->
  97.  
  98. <table class="zpExpandedTable" id="resoldatetab" cellpadding="1" cellspacing="0">
  99. <tr>
  100. <td id="paddingformultitop">
  101. Resolution Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
  102. </td>
  103. <td>
  104. <input type="text" name="resdate_#count#" value="">&nbsp;&nbsp;
  105.  
  106. &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
  107. <input type="checkbox" name="currentdateresol_#count#" 
  108. onClick="resdate_#count#.value=fill_date()">
  109.  
  110. </td>
  111. <td>
  112. Resolution Verified as effective by:&nbsp;&nbsp;
  113. </td>
  114. <td>
  115. <select name="resvertified_#count#">
  116. <option value="" selected>Make A Selection</option>
  117. <cfloop query="gettech">
  118. <option value="#fname# #lname#">#fname# #lname#</option>
  119. </cfloop>
  120. </select>
  121. </td>
  122. </tr>
  123. </table>
  124. <!--- Shows what was previously entered for Vertification Date, Current Date (for vertification date)   --->
  125. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  126. <tr>
  127. <td id="paddingformultitop">
  128. Verification Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
  129. </td>
  130. <td class="vertificationmoveinmulti">
  131. <input type="text" name="vertifidate_#count#" value="">&nbsp;&nbsp;
  132. &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
  133. <input type="checkbox" name="currentdatevert_#count#" 
  134. onClick="vertifidate_#count#.value=fill_date()">
  135.  
  136. </td>
  137. </tr>
  138. </table>
  139.  
  140. <!--- Shows what was previously entered for Dept/Vendor Responsibility  --->
  141. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  142. <tr>
  143. <td class="red" id="paddingformultitop">
  144. Dept/Vendor Responsibility*:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  145. <select name="deptvendor_#count#">
  146. <option value="" selected>Make A Selection</option>
  147. <cfloop query="getDeptVendor">
  148. <option value="#pk_deptVendor#">#pk_deptVendor#</option>
  149. </cfloop>
  150. </select>
  151. </td>
  152. </tr>
  153. </table>
  154.  
  155. <input type="hidden" name="serialcount" value="#count#">
  156.  <!--- Adds Delete to every ticket  --->
  157. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  158. <tr>
  159. <td>
  160. <input type="button" class="removeticket" value="Remove Serial #count#" onclick="removeElement('dynamic#count#Input')">
  161. </td>
  162. </tr>
  163. <tr>
  164. <td>
  165. <input type="button" class="addticket" value="Add Parts" onclick=
  166. "addpartInput('dynamic#count#Input')">
  167. </td>
  168. </tr>
  169. </table>
  170. </div>
  171. </cfoutput>
  172. <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
  173. </cfif>
partsdisplay.cfm
Expand|Select|Wrap|Line Numbers
  1. <!---IF HAVE ANY BLANKS IN ANY FIELDS THIS MAKES IT SO THE FIELD WILL SHOW UP--->
  2.  
  3. <cfif parts.recordcount is 0>  
  4. <cfset count1 = 0>
  5. <cfoutput>
  6. <cfset count1 = count1 + 1>
  7. <div id="part#count1#Name#count#">
  8. <!---THIS IS THE PARTS SECTION--->
  9. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  10. <th class="sectiontitle" colspan="7">Parts Information #count1# Serial Information #count#</th>
  11. <tr>
  12. <td class='indent' id='formfieldpadding'>HC P/N:&nbsp;&nbsp;&nbsp;<input type='text' name="hcpn_#count1#_#count#" style="margin:0px" value=""></td>
  13. <td>
  14. Parts been returned*
  15. <input type="checkbox" name="partsreturn_#count1#_#count#" value=""<cfif #part_returned# eq "1">checked=yes</cfif>/>
  16. </td>
  17. <td>
  18. <td class="indent">Defective<input type="checkbox" name="defective_#count1#_#count#" value=""<cfif #defective# eq "1">checked=yes</cfif>/></td>
  19. </td>
  20. </tr>
  21. </table>
  22. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#">
  23.  
  24. <!--- Shows what was previously entered for RMA Data Only  --->
  25. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  26. <tr>
  27. <td id="paddingformultitop">
  28. RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;
  29. </td>
  30. <td class="rmanmoveinmulti">
  31. ( You may enter up to 1000 characters. )
  32. <br/>
  33. <textarea maxlength="1000" onkeyup="return rmaismaxlength(this)" onkeydown="return rmaismaxlength(this)" rows="4" cols="60" name="rma_#count1#_#count#" ></textarea>
  34. </td>
  35. </tr>
  36. </table>
  37.  
  38.  
  39. <!--- Adds Delete to every ticket  --->
  40. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  41. <tr>
  42. <td>
  43. <input type="button" class="removeticket" value="Remove Parts #count1#" 
  44. onclick="removetheElement('part#count1#Name#count#')"></a>
  45. </td>
  46. </td>
  47. </tr>
  48. </table>
  49. </div>
  50. </cfoutput>
  51. <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
  52. </cfif>
Thank you,
Rach
Nov 5 '08 #177
bonneylake
769 512MB
Hey Acoder,

After trying a few more tests. I think parts might be the problem.
what i did was submitted and entry where there was only a serial (no parts). When i went to look back at it i saw nothing for parts (i commented out partsdisplay.cfm).An i opened up firebug an i saw nothing associated with parts in there. However, when i click to add another serial and view it in firebug, it included these 2 lines.

Expand|Select|Wrap|Line Numbers
  1. <input id="partscount2" type="hidden" value="0" name="partscount2"/>
  2. <input id="part2count2" type="hidden" value="" name="part2count2"/>
  3. <input id="serialcount" type="hidden" value="2" name="serialcount"/>
the thing with it is i have not added a part to this new serial yet. An i never added a part to the old serial but yet its counting it like i did add a part. Also, i even tried just submitted the previously fill in serial with no extra serial or any parts an i got the error
Expand|Select|Wrap|Line Numbers
  1.  An error occurred while evaluating the expression:
  2.  
  3. "#form['part2count' & machinecount]#"
  4.  
  5. Error near line 91, column 20.
  6.  
  7. The member "PART2COUNT1" in dimension 1 of object "form" cannot be found. Please, modify the member name.
  8.  
i think parts could possible be adding something extra to it. The only way it can be adding extra to it. Is in the javascript under the serial function of the javascript there is these 3 lines

Expand|Select|Wrap|Line Numbers
  1. "<input type='hidden' name='"+partc+"' id='"+partc+"' value='0'>" +
  2. "<input type='hidden' name='"+part2c+"' id='"+part2c+"' value=''>" +
  3. "<input type='hidden' name='serialcount' id='serialcount' value='" + count + "'>";
the only thing i can think of to prevent it is to move the 2 part lines to the parts function of the javascript. However, i am not sure how to do this without running into problems.

Thank you,
Rach
Nov 5 '08 #178
acoder
16,027 Expert Mod 8TB
You're right about the serial/parts displays.
However, the thing is it will only show the duplicate if i click the final submit. If i am on cticketpage2edit and close it out an go to relook at it, it doesn't insert the duplicate. Just when i click that final submit button. An like i said when i took out all the javascript at the top, it didn't show a duplicate when i clicked on that final submit button and viewed the information again.
Now, can you explain this again in more detail? Is the submit button on the cticketpage2edit page? When you say relook, do you mean this edit page or the page before? Also, by "insert duplicate", you mean display a duplicate entry because it's not physically creating a duplicate in the database, right?

How many pages are there in total in the whole process of creating/updating serials/parts and what's the purpose of each page?
Nov 5 '08 #179
bonneylake
769 512MB
You're right about the serial/parts displays.

Now, can you explain this again in more detail? Is the submit button on the cticketpage2edit page? When you say relook, do you mean this edit page or the page before? Also, by "insert duplicate", you mean display a duplicate entry because it's not physically creating a duplicate in the database, right?

How many pages are there in total in the whole process of creating/updating serials/parts and what's the purpose of each page?
Hey Acoder,

Alrighty here we go. Alrighty yes the submit button (final submit) button is on cticketpage2edit.cfm. When i say relook i mean once i make changes, submit the changes an then reopen cticketpage2edit to see the changes i made is when i notice it. It does not insert duplicate entrys into the table it only displays duplicate entrys when i go back an look at cticketpage2edit.

Alrighty there are 2 pages. Cticketpage1edit.cfm displays the general information and contact information. When i click submit on cticketpage1edit.cfm it takes me to cticketpage2edit.cfm where it redisplays the general information and contact information and it also allows the user to add/edit serials and parts (cticketpage1edit has nothing involving serial or parts). Because the form is long we split it into 2 pages to make it easier on the person filling out the information. On the second page is where the user edit/enters serial information and parts information an once the user is done then the user resubmits all the information from general information and contact information an also submits all the changes for serial and parts.

i don't know if this would help. But this is what i have in full on the cticketpage2edit.cfm page.


querys that display the information
Expand|Select|Wrap|Line Numbers
  1. <cfquery name="models" datasource="systems">
  2. Select distinct Model 
  3. From models
  4. </cfquery>
  5.  
  6. <!---Shows what was previously entered into serial and description table--->
  7. <cfquery name="serial" datasource="CustomerSupport">
  8.         SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware,
  9.        resolution,resolution_date,verification_date,type_hardware_failure,
  10.         dept_responsibility,resolution_verified_by,fk_serialNo,fk_ticketNo,description
  11.         FROM dbo.tbl_CS_serial
  12.         LEFT JOIN dbo.tbl_CS_notes_descr
  13.         ON dbo.tbl_CS_serial.pkb_fk_ticketNo=dbo.tbl_CS_notes_descr.fk_ticketNo and
  14.         dbo.tbl_CS_serial.pka_serialNo=dbo.tbl_CS_notes_descr.fk_serialNo
  15.         WHERE pkb_fk_ticketNo = #URL.pk_ticketID# and fk_ticketNo = #URL.pk_ticketID#
  16.         ORDER BY pkb_fk_ticketNo
  17. </cfquery>
  18.  
  19. <!---Shows what was previously entered into parts table--->
  20. <cfquery name="parts" datasource="CustomerSupport">
  21.        SELECT pk_partID,fk_serialNo,fk_ticketNo,hc_partNo,ltrim(rtrim(part_returned)) as        part_returned,rma_number,defective
  22.          FROM dbo.tbl_CS_parts
  23.          WHERE fk_ticketNo = #URL.pk_ticketID#
  24. </cfquery>
  25.  
the javascript for serial and parts

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

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

What i do is once i resubmit i completely close out the window. An i have another window open an its open to a page called index.cfm page which lists all the tickets that have been submitted and i click on the ticket that i edited an that takes me to cticketpage1edit.cfm an takes me back through the process of going to cticketpage2edit.cfm and then resubmitting again.

Thank you,
Rach
Nov 5 '08 #182
bonneylake
769 512MB
Hey Acoder,

I was just playing with it an i noticed something. I was on cticketpage2edit.cfm and i accidently hit back to cticketpage1edit.cfm an well then i decided to click submit on cticketpage1edit.cfm to take me back to cticketpage2edit.cfm an it added another serial and part with it! so far i have only been able to redo this once. Is there a possibility that the url method could be adding everytime i go to cticketpage2edit.cfm? or is strickly javascript causeing it?

Thank you,
Rach
Nov 5 '08 #183
acoder
16,027 Expert Mod 8TB
I missed one of your earlier posts. I think you're along the right lines when you say the parts might be the problem. Note that the two input hidden fields relating to parts "partscount#count#" and "part2count#count#" should only appear once for each serial. What these do is count the number of parts for the serial and list the number of the parts, so obviously they should only appear once for each serial.

Having had a closer look at your code, I now see where the problem potentially lies. In your HTML code snippet (posted in #180), look at lines 202/203. You have these two hidden input lines, but they're in the parts display code rather than serials. You need to move them up to the serials display as well as the code which generates the values.

On hindsight, I realise that some of this could have been avoided if it was kept simple as is the case with the serialcount, but we play with what we've got.
Nov 6 '08 #184
bonneylake
769 512MB
Hey Acoder,

i am not sure if i did this correctly, but i am running into the same trouble as before. The part that has been confused is that. When we do the second count for parts we do

Expand|Select|Wrap|Line Numbers
  1. <cfset count1 = 0>
  2. <cfloop query="getparts">
  3. <div id="part#count1#Name#count#">
  4. <cfset count1 = count1 + 1>
and the thing is this hidden field depends on that count

Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#">
  2.  

so i am not sure if i move everything for getparts to make it loop or what to make it get the correct value for the second hidden field.

This is what 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. <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. <cfset count1 = 0>
  167. <cfset count1 = count1 + 1>
  168.  
  169. <cfset partliststr = "">
  170. <cfloop from="1" to="#count1#" index="pl">
  171. <cfset partliststr = partliststr & #pl# & ",">
  172. </cfloop>
  173.  
  174. <input type="hidden" name="part2count#count#" id="part2count#count#" value="#partliststr#">
  175. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#">
  176. <!--- Adds Delete to every ticket  --->
  177. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  178. <tr>
  179. <td>
  180. <input type="button" class="removeticket" value="Remove Serial #count#" onclick="removeElement('dynamic#count#Input')">
  181. </td>
  182. </tr>
  183. <tr>
  184. <td>
  185. <input type="button" class="addticket" value="Add Parts" onclick=
  186. "addpartInput('dynamic#count#Input')">
  187. </td>
  188. </tr>
  189. </table>
  190.  
  191.  
  192. <!---Shows what was previously entered into parts table--->
  193. <!---dbtype="query"--->
  194. <cfquery name="getparts" dbtype="query" >
  195. SELECT *
  196. FROM parts
  197. WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
  198. cfsqltype="cf_sql_char" maxLength="20">
  199. </cfquery>
  200.  
  201. <!---<cfif serial.recordcount is 0>--->
  202. <cfloop query="getparts">
  203. <div id="part#count1#Name#count#">
  204.  
  205. <!---THIS IS THE PARTS SECTION--->
  206.  
  207.  
  208.  
  209. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  210. <th class="sectiontitle" colspan="7">Parts Information #count1# Serial Information #count#</th>
  211. <tr>
  212. <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>
  213. <td>
  214. Parts been returned*
  215. <input type="checkbox" name="partsreturn_#count1#_#count#" value="#part_returned#"<cfif #part_returned# eq "1">checked=yes</cfif>/>
  216. </td>
  217. <td>
  218. <td class="indent">Defective<input type="checkbox" name="defective_#count1#_#count#" value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/></td>
  219. </td>
  220. </tr>
  221. </table>
  222. <!---<input type="hidden" name="partscount#count#" id="partscount#count#" value="#count#">--->
  223.  
  224.  
  225. <!--- Shows what was previously entered for RMA Data Only  --->
  226. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  227. <tr>
  228. <td id="paddingformultitop">
  229. RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;
  230. </td>
  231. <td class="rmanmoveinmulti">
  232. ( You may enter up to 1000 characters. )
  233. <br/>
  234. <textarea maxlength="1000" onkeyup="return rmaismaxlength(this)" onkeydown="return rmaismaxlength(this)" rows="4" cols="60" name="rma_#count1#_#count#" >#rma_number#</textarea>
  235. </td>
  236. </tr>
  237. </table>
  238.  
  239.  
  240. <!--- Adds Delete to every ticket  --->
  241. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  242. <tr>
  243. <td>
  244. <input type="button" class="removeticket" value="Remove Parts #count1#" 
  245. onclick="removetheElement('part#count1#Name#count#',#count#,#count#)"></a>
  246. </td>
  247. </td>
  248. </tr>
  249. </table>
  250. </div>
  251. </cfloop>
  252. </div> 
  253. </cfoutput>
  254. <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
  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 6 '08 #185
acoder
16,027 Expert Mod 8TB
That wouldn't work properly because the parts count variable count1 needs to be incremented in a loop.

I think because of the possible problems trying to get this working smoothly, it might be an idea to move the parts count into parts as you were suggesting. This would remove the need to re-generate the parts numbers and the list would be generated for the next page when submitted by Coldfusion anyway.
Nov 6 '08 #186
bonneylake
769 512MB
That wouldn't work properly because the parts count variable count1 needs to be incremented in a loop.

I think because of the possible problems trying to get this working smoothly, it might be an idea to move the parts count into parts as you were suggesting. This would remove the need to re-generate the parts numbers and the list would be generated for the next page when submitted by Coldfusion anyway.
Hey Acoder,

are you saying in the javascript to move the 2 parts count lines from serial function to the parts function? an then leave the parts section in the html how i had it? or are you suggestion i just leave the count1 in the parts section of the html and put the other part count in the serial part of the html?

an if its the html way i just not sure what to take out in the parts function an what needs to stay to make the new changes work.

heres the serial and parts functions
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.  
  18. <!---Allows us to add PARTS information multiple times--->
  19. <script type="text/javascript">
  20. <!---Adds multiple fields for parts --->
  21. function addpartInput(partName){
  22. var parts = document.getElementById(partName);
  23. var getparts = document.getElementById('div');
  24. var serialno = partName.replace("dynamic","").replace("Input","");
  25. var avalue = document.getElementById("partscount"+serialno);
  26. var count = parseInt(avalue.value) + 1;
  27. avalue.value = count;
  28. var partslist = document.getElementById("part2count"+serialno);
  29. partslist.value += count + ",";
  30. var partdiv = document.createElement('div');
  31. var partIdName = 'part' + count + 'Name' + serialno;
  32.  
  33.  
  34. partdiv.setAttribute('id',partIdName);
Thank you,
Rach
Nov 6 '08 #187
acoder
16,027 Expert Mod 8TB
Look at how the serialcount is done. There's one per serial. If you have three serials 1, 2 and 4, then the counts would be 1, 2, and 4. If you now add one more, it'd be 5. When submitted, this would be sent as "1,2,4,5" - exactly what you need.

You need something similar for part counts. The only difference is that you have one per part, so they will need to be named different for each serial, e.g. partscount1 for serial 1, partscount2 for serial 2 and so on.

If you do this, then there's no need for two hidden fields for part counts, just one will do, because this new way will do both jobs at once. So, all parts-counts for serial 1 would be submitted in partscount1 and available in the submitted page as form.partscount1.

This would need to change in both the HTML and the JavaScript. It will also mean that there's no need for the loop to generate the values - just add an input field for each part with the count in the getparts loop. You will also no longer need to remove values when removing parts in removetheElement().
Nov 6 '08 #188
bonneylake
769 512MB
Hey Acoder,

So your saying to remove to 2 parts in the serial function i have which is

Expand|Select|Wrap|Line Numbers
  1. "<input type='hidden' name='"+partc+"' id='"+partc+"' value='0'>" +
  2. "<input type='hidden' name='"+part2c+"' id='"+part2c+"' value=''>" +
Then in the parts section add a hidden field like so

Expand|Select|Wrap|Line Numbers
  1. "<input type='hidden' name='partscount' id='partscount' value='" + count + "_"+serialno+"'>";
an then in the html i would remove the following

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#">
  7. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#">
an just put
Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="partscount" id="partscount" value="#count1#">
would this be right?

Thank you,
Rach
Nov 6 '08 #189
acoder
16,027 Expert Mod 8TB
Not quite. You can't call it partscount only. You'd have to name each one with the serial number, e.g. for serial 2, it'd be named partscount2. The HTML looks right, but in the JavaScript, the value should be set to the current part number.
Nov 6 '08 #190
bonneylake
769 512MB
Not quite. You can't call it partscount only. You'd have to name each one with the serial number, e.g. for serial 2, it'd be named partscount2. The HTML looks right, but in the JavaScript, the value should be set to the current part number.
Hey Acoder,

Ok i am sorta lost. Are you saying for parts count that the value can't just be

Expand|Select|Wrap|Line Numbers
  1. "<input type='hidden' name='partscount' id='partscount' value='" + count + "_"+serialno+"'>";
it has to be something like

Expand|Select|Wrap|Line Numbers
  1. "<input type='hidden' name='partscount" + count + "' id='partscount' value='+ count +'>";
Thank you,
Rach
Nov 6 '08 #191
acoder
16,027 Expert Mod 8TB
The name should be "partscount" + the serial no. and, yes, the value should be count.
Nov 6 '08 #192
bonneylake
769 512MB
The name should be "partscount" + the serial no. and, yes, the value should be count.
Hey Acoder,

So the hidden input field in the javascript part should be the following?

Expand|Select|Wrap|Line Numbers
  1. "<input type='hidden' name='"partscount" + serialno + ' id='partscount' value='" + count + "'>";
an then in the parts function what needs to be removed? in the serial function i got rid of along with the 2 hidden fields.
Expand|Select|Wrap|Line Numbers
  1. var partc = 'partscount'+count;
  2. var part2c = 'part2count'+count; 
  3.  
but i have no clue what in parts needs to stay or go.

Expand|Select|Wrap|Line Numbers
  1. <!---Allows us to add PARTS information multiple times--->
  2. <script type="text/javascript">
  3. <!---Adds multiple fields for parts --->
  4. function addpartInput(partName){
  5. var parts = document.getElementById(partName);
  6. var getparts = document.getElementById('div');
  7. var serialno = partName.replace("dynamic","").replace("Input","");
  8. var avalue = document.getElementById("partscount"+serialno);
  9. var count = parseInt(avalue.value) + 1;
  10. avalue.value = count;
  11. var partslist = document.getElementById("part2count"+serialno);
  12. partslist.value += count + ",";
  13. var partdiv = document.createElement('div');
  14. var partIdName = 'part' + count + 'Name' + serialno;
  15. partdiv.setAttribute('id',partIdName);
  16.  
  17.  
  18. <!---Allows us to remove multiple fields--->
  19. function removetheElement(divNum, serialno, partnum) {
  20.   <!---var d = document.getElementById('partsInput');--->
  21.   var partslist = document.getElementById("part2count"+serialno);
  22.   partslist.value = partslist.value.replace(partnum+',',"");
  23.   var olddiv = document.getElementById(divNum);
  24.  olddiv.parentNode.removeChild(olddiv);
  25. }
Thank you,
Rach
Nov 6 '08 #193
acoder
16,027 Expert Mod 8TB
So the hidden input field in the javascript part should be the following?

Expand|Select|Wrap|Line Numbers
  1. "<input type='hidden' name='"partscount" + serialno + ' id='partscount' value='" + count + "'>";
The quotes are a bit mixed up and you no longer need the ID as it won't be referenced in JavaScript. Something like:
Expand|Select|Wrap|Line Numbers
  1. "<input type='hidden' name='partscount" + serialno + "' value='" + count + "'>";
an then in the parts function what needs to be removed?
Any reference to partslist, so in that code snippet, lines 11/12 and 21/22.
Nov 6 '08 #194
bonneylake
769 512MB
The quotes are a bit mixed up and you no longer need the ID as it won't be referenced in JavaScript. Something like:
Expand|Select|Wrap|Line Numbers
  1. "<input type='hidden' name='partscount" + serialno + "' value='" + count + "'>";
Any reference to partslist, so in that code snippet, lines 11/12 and 21/22.
Hey Acoder,

Alrighty i did everything you said. i am not sure if there is anything else to it, but for now i am still stuck on the same problem an i can not add parts right now.

Thank you,
Rach
Nov 6 '08 #195
acoder
16,027 Expert Mod 8TB
If you can't add parts, that means there must be some error in the addpartInput function. Have you had a look at the error console?
Nov 6 '08 #196
bonneylake
769 512MB
If you can't add parts, that means there must be some error in the addpartInput function. Have you had a look at the error console?
Hey Acoder,

The error it gives me is it says avalue has no properties An i know it has to do with partscount but not sure what to replace it with.

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. <!---Adds multiple fields for parts --->
  3. function addpartInput(partName){
  4. var parts = document.getElementById(partName);
  5. var getparts = document.getElementById('div');
  6. var serialno = partName.replace("dynamic","").replace("Input","");
  7. var avalue = document.getElementById("partscount"+serialno);
  8. var count = parseInt(avalue.value) + 1;
  9. avalue.value = count;
  10. var partdiv = document.createElement('div');
  11. var partIdName = 'part' + count + 'Name' + serialno;
  12.  
  13. partdiv.setAttribute('id',partIdName);
Thank you,
Rach
Nov 6 '08 #197
acoder
16,027 Expert Mod 8TB
I see. You will need to add an input field for each serial that holds the part count. You have one "theValue" for serial count. For parts counts, add one in the HTML for each serial. You could call it "partcounter"+serial no. Then replace "partscount" on line 7 with "partcounter".
Nov 6 '08 #198
bonneylake
769 512MB
I see. You will need to add an input field for each serial that holds the part count. You have one "theValue" for serial count. For parts counts, add one in the HTML for each serial. You could call it "partcounter"+serial no. Then replace "partscount" on line 7 with "partcounter".
Hey Acoder,

Ok i replaced the one part in the javascript with partcounter. an then i created this for the hidden field but i am pretty sure i did something wrong because still not right.
Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
  2. <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="partcounter" id="partcounter" />
parts function
Expand|Select|Wrap|Line Numbers
  1. function addpartInput(partName){
  2. var parts = document.getElementById(partName);
  3. var getparts = document.getElementById('div');
  4. var serialno = partName.replace("dynamic","").replace("Input","");
  5. var avalue = document.getElementById("partcounter"+serialno);
  6. var count = parseInt(avalue.value) + 1;
  7. avalue.value = count;
  8. var partdiv = document.createElement('div');
  9. var partIdName = 'part' + count + 'Name' + serialno;
Thank you,
Rach
Nov 6 '08 #199
acoder
16,027 Expert Mod 8TB
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.
Nov 6 '08 #200

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
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.