By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,676 Members | 1,708 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,676 IT Pros & Developers. It's quick & easy.

displaying previously entered multiple fields

100+
P: 769
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 #1

✓ answered by acoder

You don't want all the parts at once. You want parts for each serial separately. To avoid creating a separate query for each, get all the parts and then use a query of queries to get parts for each serial separately.

Share this Question
Share on Google+
482 Replies


acoder
Expert Mod 15k+
P: 16,027
Does the query for parts only get the parts for the current serial? Show the code for the cfquery.
Oct 17 '08 #2

100+
P: 769
Does the query for parts only get the parts for the current serial? Show the code for the cfquery.
Hey Acoder,

well the parts is getting the correct information for that ticket an so is the serial. Its just repeating the results instead of the correct part going under the correct serial. But here is the cfquery

for serial
Expand|Select|Wrap|Line Numbers
  1. <!---Shows what was previously entered into serial and description table--->
  2. <cfquery name="serial" datasource="CustomerSupport">
  3.         SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware,
  4.        resolution,resolution_date,verification_date,rma_data,type_hardware_failure,
  5.         dept_responsibility,resolution_verified_by,fk_serialNo,fk_ticketNo,description
  6.         FROM dbo.tbl_CS_serial
  7.         LEFT JOIN dbo.tbl_CS_notes_descr
  8.         ON dbo.tbl_CS_serial.pkb_fk_ticketNo=dbo.tbl_CS_notes_descr.fk_ticketNo and
  9.         dbo.tbl_CS_serial.pka_serialNo=dbo.tbl_CS_notes_descr.fk_serialNo
  10.         WHERE pkb_fk_ticketNo = #URL.pk_ticketID# and fk_ticketNo = #URL.pk_ticketID#
  11.         ORDER BY pkb_fk_ticketNo
  12. </cfquery>
for parts

Expand|Select|Wrap|Line Numbers
  1. <!---Shows what was previously entered into parts table--->
  2. <cfquery name="parts" datasource="CustomerSupport">
  3.         SELECT pk_partID,fk_serialNo,fk_ticketNo,hc_partNo,ltrim(rtrim(part_returned)) as part_returned,defective,submission
  4.          FROM dbo.tbl_CS_parts
  5.          WHERE fk_ticketNo = #URL.pk_ticketID#
  6. </cfquery>
Thank you,
Rach
Oct 17 '08 #3

acoder
Expert Mod 15k+
P: 16,027
You don't want all the parts at once. You want parts for each serial separately. To avoid creating a separate query for each, get all the parts and then use a query of queries to get parts for each serial separately.
Oct 17 '08 #4

100+
P: 769
You don't want all the parts at once. You want parts for each serial separately. To avoid creating a separate query for each, get all the parts and then use a query of queries to get parts for each serial separately.
Hey Acoder,

Well how would create a query of queries to get the parts?

Thank you,
Rach
Oct 17 '08 #5

acoder
Expert Mod 15k+
P: 16,027
Use the current query and then instead of querying the database, you query the query. To do that, set the dbtype attribute of cfquery to "query". See Query of Queries
Oct 17 '08 #6

100+
P: 769
Use the current query and then instead of querying the database, you query the query. To do that, set the dbtype attribute of cfquery to "query". See Query of Queries
Hey Acoder,

Is this all i need to do to it. I read over your link but i am still a bit confused.

Expand|Select|Wrap|Line Numbers
  1. <!---Shows what was previously entered into parts table--->
  2. <cfquery name="parts" datasource="CustomerSupport" dbtype="query">
  3.         SELECT pk_partID,fk_serialNo,fk_ticketNo,hc_partNo,ltrim(rtrim(part_returned)) as part_returned,defective,submission
  4.          FROM dbo.tbl_CS_parts
  5.          WHERE fk_ticketNo = #URL.pk_ticketID#
  6. </cfquery>
  7.  
Thank you,
Rach
Oct 17 '08 #7

acoder
Expert Mod 15k+
P: 16,027
Well, to be honest, you don't necessarily need a query of queries. However, if you're looking at performance benefits and efficiency, it makes sense. We can carry on down this route, but if you feel that you just want to get it working without looking at some new type of coding, then we can look at the inefficient solution.

Your query of queries should query the parts query, not the database and you can just select * because you already have only the fields that you need.
Oct 17 '08 #8

100+
P: 769
Well, to be honest, you don't necessarily need a query of queries. However, if you're looking at performance benefits and efficiency, it makes sense. We can carry on down this route, but if you feel that you just want to get it working without looking at some new type of coding, then we can look at the inefficient solution.

Your query of queries should query the parts query, not the database and you can just select * because you already have only the fields that you need.
Hey Acoder,

Well the faster the better so i guess we can stick with what we are doing. But here is what i have now. I looked at the example better an think i understand a bit more. The one part i am confused on is what would i put for cfqueryparam. Would i put what i had before which is the pk_ticketID?

Expand|Select|Wrap|Line Numbers
  1. <cfquery name="parts" dbtype="query" >
  2.         SELECT *
  3.          FROM dbo.tbl_CS_parts
  4.          WHERE fk_ticketNo <cfqueryparam value="#LastNameSearch#" 
  5. cfsqltype="cf_sql_char" maxLength="20">
  6. </cfquery>
Thank you,
Rach
Oct 17 '08 #9

acoder
Expert Mod 15k+
P: 16,027
Replace lastnamesearch with serial number (the field name from the serial query).
Oct 17 '08 #10

100+
P: 769
Replace lastnamesearch with serial number (the field name from the serial query).
Hey Acoder,

Do i replace the lastnamesearch with the serial number field from the serial table or the serial number field from the parts table? both tables have a serial field and both contain the same serial number. Right now i am using the serial field from parts table.

Expand|Select|Wrap|Line Numbers
  1. <cfquery name="parts" dbtype="query" >
  2. SELECT *
  3. FROM dbo.tbl_CS_parts
  4. WHERE fk_ticketNo <cfqueryparam value="#fk_serialNo#" 
  5. cfsqltype="cf_sql_char" maxLength="20">
  6. </cfquery>
Thank you,
Rach
Oct 17 '08 #11

acoder
Expert Mod 15k+
P: 16,027
It should be the field from the serial query. Also change the FROM clause to the name of the query that selects all parts. If it's parts, don't use the same name to name this particular query.
Oct 17 '08 #12

100+
P: 769
It should be the field from the serial query. Also change the FROM clause to the name of the query that selects all parts. If it's parts, don't use the same name to name this particular query.
Hey Acoder,

Here is what i did, not sure if i did it right.

Expand|Select|Wrap|Line Numbers
  1. <cfquery name="getparts" dbtype="query" >
  2. SELECT *
  3. FROM dbo.tbl_CS_parts
  4. WHERE fk_ticketNo <cfqueryparam value="#pka_serialNo#" 
  5. cfsqltype="cf_sql_char" maxLength="20">
  6. </cfquery>
  7.  
Thank you,
Rach
Oct 17 '08 #13

acoder
Expert Mod 15k+
P: 16,027
It should query "parts" (name of the first query), not dbo... and shouldn't the field being checked in the WHERE clause be fk_serialno? You also forgot an =.
Oct 17 '08 #14

100+
P: 769
It should query "parts" (name of the first query), not dbo... and shouldn't the field being checked in the WHERE clause be fk_serialno? You also forgot an =.
Hey Acoder,

Yes you are right it should be fk_serialNo. An i been thinking the whole we only needed the one parts my bad. Ok so the whole thing should be the following

Expand|Select|Wrap|Line Numbers
  1. <!---Shows what was previously entered into parts table--->
  2. <cfquery name="parts" datasource="CustomerSupport">
  3.         SELECT pk_partID,fk_serialNo,fk_ticketNo,hc_partNo,ltrim(rtrim(part_returned)) as part_returned,defective,submission
  4.          FROM dbo.tbl_CS_parts
  5.          WHERE fk_ticketNo = #URL.pk_ticketID#
  6. </cfquery>
  7.  
  8. <cfquery name="getparts" dbtype="query" >
  9. SELECT *
  10. FROM dbo.tbl_CS_parts
  11. WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
  12. cfsqltype="cf_sql_char" maxLength="20">
  13. </cfquery>
Thank you,
Rach
Oct 17 '08 #15

acoder
Expert Mod 15k+
P: 16,027
Now this getparts query should be after the serial display and before the parts output and you would loop this query.
Oct 17 '08 #16

100+
P: 769
Now this getparts query should be after the serial display and before the parts output and you would loop this query.
Hey Acoder,

So would i just put a loop around the getparts query an then would it be like
<cfloop from="" to=""> or a different type of loop? an if it is this type of loop what would i put in from and to? but here is what i have

Expand|Select|Wrap|Line Numbers
  1. <!---Shows what was previously entered into serial and description table--->
  2. <cfquery name="serial" datasource="CustomerSupport">
  3.         SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware,
  4.        resolution,resolution_date,verification_date,rma_data,type_hardware_failure,
  5.         dept_responsibility,resolution_verified_by,fk_serialNo,fk_ticketNo,description
  6.         FROM dbo.tbl_CS_serial
  7.         LEFT JOIN dbo.tbl_CS_notes_descr
  8.         ON dbo.tbl_CS_serial.pkb_fk_ticketNo=dbo.tbl_CS_notes_descr.fk_ticketNo and
  9.         dbo.tbl_CS_serial.pka_serialNo=dbo.tbl_CS_notes_descr.fk_serialNo
  10.         WHERE pkb_fk_ticketNo = #URL.pk_ticketID# and fk_ticketNo = #URL.pk_ticketID#
  11.         ORDER BY pkb_fk_ticketNo
  12. </cfquery>
  13.  
  14. <!---Shows what was previously entered into parts table--->
  15. <!---dbtype="query"--->
  16. <cfquery name="getparts" dbtype="query" >
  17. SELECT *
  18. FROM dbo.tbl_CS_parts
  19. WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
  20. cfsqltype="cf_sql_char" maxLength="20">
  21. </cfquery>
  22.  
  23. <!---Shows what was previously entered into parts table--->
  24. <cfquery name="parts" datasource="CustomerSupport">
  25.        SELECT pk_partID,fk_serialNo,fk_ticketNo,hc_partNo,ltrim(  rtrim(part_returned)) as        part_returned,defective,submission
  26.          FROM dbo.tbl_CS_parts
  27.          WHERE fk_ticketNo = #URL.pk_ticketID#
  28. </cfquery>
Thank you,
Rach
Oct 17 '08 #17

acoder
Expert Mod 15k+
P: 16,027
The FROM clause of the getparts query should be using the "parts" query, not referring to the database/table names in the database.

It should also appear after the parts query. Looping would be the normal loop over a query as you're already doing.
Oct 20 '08 #18

100+
P: 769
The FROM clause of the getparts query should be using the "parts" query, not referring to the database/table names in the database.

It should also appear after the parts query. Looping would be the normal loop over a query as you're already doing.
Hey Acoder,

So would this be correct?
Expand|Select|Wrap|Line Numbers
  1. <!---Shows what was previously entered into serial and description table--->
  2. <cfquery name="serial" datasource="CustomerSupport">
  3.         SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware,
  4.        resolution,resolution_date,verification_date,rma_data,type_hardware_failure,
  5.         dept_responsibility,resolution_verified_by,fk_serialNo,fk_ticketNo,description
  6.         FROM dbo.tbl_CS_serial
  7.         LEFT JOIN dbo.tbl_CS_notes_descr
  8.         ON dbo.tbl_CS_serial.pkb_fk_ticketNo=dbo.tbl_CS_notes_descr.fk_ticketNo and
  9.         dbo.tbl_CS_serial.pka_serialNo=dbo.tbl_CS_notes_descr.fk_serialNo
  10.         WHERE pkb_fk_ticketNo = #URL.pk_ticketID# and fk_ticketNo = #URL.pk_ticketID#
  11.         ORDER BY pkb_fk_ticketNo
  12. </cfquery>
  13.  
  14. <!---Shows what was previously entered into parts table--->
  15. <!---dbtype="query"--->
  16. <cfquery name="getparts" dbtype="query" >
  17. SELECT *
  18. FROM parts
  19. WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
  20. cfsqltype="cf_sql_char" maxLength="20">
  21. </cfquery>
  22.  
  23. <!---Shows what was previously entered into parts table--->
  24. <cfquery name="parts" datasource="CustomerSupport">
  25.        SELECT pk_partID,fk_serialNo,fk_ticketNo,hc_partNo,ltrim(  rtrim(part_returned)) as        part_returned,defective,submission
  26.          FROM dbo.tbl_CS_parts
  27.          WHERE fk_ticketNo = #URL.pk_ticketID#
  28. </cfquery>
Thank you,
Rach
Oct 20 '08 #19

acoder
Expert Mod 15k+
P: 16,027
The parts query can remain where it is, but you need to move the getparts query to where the parts are displayed. Also the cfloop on line 196 (post #1) should now be over "getparts", not parts.
Oct 20 '08 #20

100+
P: 769
The parts query can remain where it is, but you need to move the getparts query to where the parts are displayed. Also the cfloop on line 196 (post #1) should now be over "getparts", not parts.
Hey Acoder,

When i move the cfloop. Do i need to include the count that i had around the cfloop or just take it out?
Thank you,
Rach
Oct 20 '08 #21

acoder
Expert Mod 15k+
P: 16,027
You don't need to move the loop. Just replace "parts" with "getparts".
Oct 20 '08 #22

100+
P: 769
You don't need to move the loop. Just replace "parts" with "getparts".
Hey Acoder,

When i go to view one i previously submitted i am getting the error

Error resolving parameter PKA_SERIALNO


ColdFusion was unable to determine the value of the parameter

here is what i have

Expand|Select|Wrap|Line Numbers
  1. <!---Shows what was previously entered into serial and description table--->
  2. <cfquery name="serial" datasource="CustomerSupport">
  3.         SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware,
  4.        resolution,resolution_date,verification_date,rma_data,type_hardware_failure,
  5.         dept_responsibility,resolution_verified_by,fk_serialNo,fk_ticketNo,description
  6.         FROM dbo.tbl_CS_serial
  7.         LEFT JOIN dbo.tbl_CS_notes_descr
  8.         ON dbo.tbl_CS_serial.pkb_fk_ticketNo=dbo.tbl_CS_notes_descr.fk_ticketNo and
  9.         dbo.tbl_CS_serial.pka_serialNo=dbo.tbl_CS_notes_descr.fk_serialNo
  10.         WHERE pkb_fk_ticketNo = #URL.pk_ticketID# and fk_ticketNo = #URL.pk_ticketID#
  11.         ORDER BY pkb_fk_ticketNo
  12. </cfquery>
  13.  
  14. <!---Shows what was previously entered into parts table--->
  15. <cfquery name="parts" datasource="CustomerSupport">
  16.        SELECT pk_partID,fk_serialNo,fk_ticketNo,hc_partNo,ltrim(  rtrim(part_returned)) as        part_returned,defective,submission
  17.          FROM dbo.tbl_CS_parts
  18.          WHERE fk_ticketNo = #URL.pk_ticketID#
  19. </cfquery>
  20.  
  21. <!---Shows what was previously entered into parts table--->
  22. <!---dbtype="query"--->
  23. <cfquery name="getparts" dbtype="query" >
  24. SELECT *
  25. FROM parts
  26. WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
  27. cfsqltype="cf_sql_char" maxLength="20">
  28. </cfquery>
Thank you,
Rach
Oct 20 '08 #23

acoder
Expert Mod 15k+
P: 16,027
That's because pka_serialNo hasn't been set yet. That query (getparts) needs to be moved to where the second inner cfloop is.
Oct 20 '08 #24

100+
P: 769
That's because pka_serialNo hasn't been set yet. That query (getparts) needs to be moved to where the second inner cfloop is.
Hey Acoder,

you saying something like this?
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. <cfloop query="getparts">
  14. <cfset model_no = #model_no#>
  15. <cfset product_type = #product_type#>
  16. <cfset type_hardware_failure = #type_hardware_failure#>
  17. <cfset software_hardware = #software_hardware#>
  18. <cfset resolution_verified_by = #resolution_verified_by#>
  19. <cfset dept_responsibility = #dept_responsibility#>
  20. <cfset count = count + 1>
  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. <!--- Shows what was previously entered for RMA Data Only  --->
  167. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  168. <tr>
  169. <td id="paddingformultitop">
  170. RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;
  171. </td>
  172. <td class="rmanmoveinmulti">
  173. ( You may enter up to 1000 characters. )
  174. <br/>
  175. <textarea maxlength="1000" onkeyup="return rmaismaxlength(this)" onkeydown="return rmaismaxlength(this)" rows="4" cols="60" name="rma_#count#" >#rma_data#</textarea>
  176. </td>
  177. </tr>
  178. </table>
  179. <input type="hidden" name="serialcount" value="#count#">
  180.  
  181. <!--- Adds Delete to every ticket  --->
  182. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  183. <tr>
  184. <td>
  185. <input type="button" class="removeticket" value="Remove Serial #count#" onclick="removeElement('dynamic#count#Input')">
  186. </td>
  187. </tr>
  188. <tr>
  189. <td>
  190. <!---<input type='button' class='addticket' value='Add Parts' onclick="addpartInput('divIdName')">--->
  191. </td>
  192. </tr>
  193. </table>
  194.  
  195. <cfset count1 = 0>
  196. <!---<cfif serial.recordcount is 0>--->
  197.  
  198. <cfset count1 = count1 + 1>
  199. <!---THIS IS THE PARTS SECTION--->
  200. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  201. <th class="sectiontitle" colspan="7">Parts Information #count1# Serial Information #count#</th>
  202. <tr>
  203. <td class='indent' id='formfieldpadding'>HC P/N:&nbsp;&nbsp;&nbsp;<input type='text' name="hcpn_#count1#" style="margin:0px" value="#hc_partNo#"></td>
  204. <td class="red">
  205. Parts been returned*
  206. <input type="checkbox" name="partsreturn_#count1#" value="#part_returned#"<cfif #part_returned# eq "1">checked=yes</cfif>/>
  207. </td>
  208. <td>
  209. <td class="indent">Defective<input type="checkbox" name="defective_#count#1" value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/></td>
  210. </td>
  211. </tr>
  212. </table>
  213.  
  214. <!--- Adds Delete to every ticket  --->
  215. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  216. <tr>
  217. <td>
  218. <input type="button" class="removeticket" value="Remove Parts #count1#" 
  219. onclick="removetheElement('partIdName')"></a>
  220. </td>
  221. </td>
  222. </tr>
  223. </table>
  224. </cfloop>
  225. </div>
  226. </cfoutput>
  227. <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
  228.  
  229.  
  230. <!---If have any blanks in serial table it will make field appear--->
  231. <cfoutput query="serial">
  232. <cfset model_no = #model_no#>
  233. <cfset product_type = #product_type#>
  234. <cfset type_hardware_failure = #type_hardware_failure#>
  235. <cfset pka_serialNo = #pka_serialNo#>
  236. <cfset software_hardware = #software_hardware#>
  237. <cfset description = #description#>
  238. <cfset resolution = #resolution#>
  239. <cfset resolution_date = #resolution_date#>
  240. <cfset resolution_verified_by = #resolution_verified_by#>
  241. <cfset verification_date = #verification_date#>
  242. <cfset dept_responsibility = #dept_responsibility#>
  243. <cfset rma_data = #rma_data#>
  244. </cfoutput>
  245. <cfif serial.recordcount is 0>
  246. <cfset model_no = "">
  247. <cfset product_type = "">
  248. <cfset type_hardware_failure = "">
  249. <cfset pka_serialNo = "">
  250. <cfset software_hardware = "">
  251. <cfset description = "">
  252. <cfset resolution = "">
  253. <cfset resolution_date = "">
  254. <cfset resolution_verified_by = "">
  255. <cfset verification_date = "">
  256. <cfset dept_responsibility = "">
  257. <cfset rma_data = "">
  258. <cfinclude template="serialdisplay.cfm">
  259. </cfif>
  260. <!---
  261. <cfset count = 0>
  262. <cfoutput query="parts">
  263. <cfset count = count + 1>
  264. <div id="partscount#count#">
  265.  
  266. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  267. <tr>
  268. <td class="indent" id="formfieldpadding">Follow up Date:(MM/DD/YYYY)&nbsp;&nbsp;&nbsp;
  269. <input type="text" name="followdate_#count#" value="" size="8"/>&nbsp;&nbsp;&nbsp;
  270. Current Date<input type="checkbox" name="followcheck_#count#" value="" onClick="followdate.value=fill_date()"/></td>
  271. <td>On Site:</td>
  272. <td><select name="onsite_#count#">
  273. <option value="No Choice" selected>No Choice</option>
  274. <option value="Yes">Yes</option>
  275. <option value="No">No</option>
  276. </select><td>
  277. <td># of Onsite:</td><td><select name="numonsite_#count#">
  278. <option value="" selected>No Choice</option>
  279. <cfloop from="0" to="10" index="nonsite"><cfoutput>
  280. <option value="#nonsite#">#nonsite#</option></cfoutput></cfloop>
  281. </select><td>
  282. </tr>
  283. </table>
  284. <input type="hidden" name="serialcount" value="#count#">
  285.  
  286.  
  287.  
  288.  
  289. <!--- Parts Information, display parts if have or don't have a value --->
  290. <cfoutput query="parts">
  291. <cfset hc_partNo = #hc_partNo#>
  292. <cfset part_returned = #part_returned#>
  293. <cfset defective = #defective#>
  294. <cfinclude template="partsdisplay.cfm">
  295. </cfoutput>
  296. <cfif parts.recordcount is 0>
  297. <cfset hc_partNo = "">
  298. <cfset part_returned = "">
  299. <cfset defective = "">
  300. <cfoutput><cfinclude template="partsdisplay.cfm"></cfoutput>
  301. </cfif>
  302.  
  303. ---></div>
  304.      <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
  305.  
Thank you,
Rach
Oct 20 '08 #25

acoder
Expert Mod 15k+
P: 16,027
I'm not sure why you've moved it there (line 13). It needed to stay where it was (line 196/7), but just changed to what it is now ("getparts").
Oct 20 '08 #26

100+
P: 769
I'm not sure why you've moved it there (line 13). It needed to stay where it was (line 196/7), but just changed to what it is now ("getparts").
Hey Acoder,

Here is what i have in full

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="getparts">
  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');" >
Thank you,
Rach
Oct 20 '08 #27

acoder
Expert Mod 15k+
P: 16,027
The getparts query should be just before the loop where it's used.
Oct 20 '08 #28

100+
P: 769
The getparts query should be just before the loop where it's used.
Hey Acoder,

That is working beautifully. The only thing i can not get working is adding parts and deleting parts. With the deleteing parts when we go an insert it we had deleting set to partIdName and i tried to change it from that to part#count1#Nameserialno but that don't seem to work. An tried to change the add part from divIdName to dynamic#count#Input. But cant seem to get it right. Here is what is in the html

Expand|Select|Wrap|Line Numbers
  1. <!--- Ticket Information 
  2.        This display the ticket Information--->
  3.  
  4. <!---<input type="hidden" value="0" id="theValue" />--->
  5.     <div id="dynamicInput"> 
  6.      <!--- All Ticket Information Appears Here--->
  7.  
  8.  
  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.  
  195. <!---Shows what was previously entered into parts table--->
  196. <!---dbtype="query"--->
  197. <cfquery name="getparts" dbtype="query" >
  198. SELECT *
  199. FROM parts
  200. WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
  201. cfsqltype="cf_sql_char" maxLength="20">
  202. </cfquery>
  203. <cfset count1 = 0>
  204. <!---<cfif serial.recordcount is 0>--->
  205. <cfloop query="getparts">
  206. <cfset count1 = count1 + 1>
  207. <!---THIS IS THE PARTS SECTION--->
  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#" style="margin:0px" value="#hc_partNo#"></td>
  212. <td class="red">
  213. Parts been returned*
  214. <input type="checkbox" name="partsreturn_#count1#" 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_#count#1" value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/></td>
  218. </td>
  219. </tr>
  220. </table>
  221.  
  222. <!--- Adds Delete to every ticket  --->
  223. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  224. <tr>
  225. <td>
  226. <input type="button" class="removeticket" value="Remove Parts #count1#" 
  227. onclick="removetheElement('partIdName')"></a>
  228. </td>
  229. </td>
  230. </tr>
  231. </table>
  232. </cfloop>
  233. </div>
  234. </cfoutput>
  235. <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
  236.  
  237.  
  238. <!---If have any blanks in serial table it will make field appear--->
  239. <cfoutput query="serial">
  240. <cfset model_no = #model_no#>
  241. <cfset product_type = #product_type#>
  242. <cfset type_hardware_failure = #type_hardware_failure#>
  243. <cfset pka_serialNo = #pka_serialNo#>
  244. <cfset software_hardware = #software_hardware#>
  245. <cfset description = #description#>
  246. <cfset resolution = #resolution#>
  247. <cfset resolution_date = #resolution_date#>
  248. <cfset resolution_verified_by = #resolution_verified_by#>
  249. <cfset verification_date = #verification_date#>
  250. <cfset dept_responsibility = #dept_responsibility#>
  251. <cfset rma_data = #rma_data#>
  252. </cfoutput>
  253. <cfif serial.recordcount is 0>
  254. <cfset model_no = "">
  255. <cfset product_type = "">
  256. <cfset type_hardware_failure = "">
  257. <cfset pka_serialNo = "">
  258. <cfset software_hardware = "">
  259. <cfset description = "">
  260. <cfset resolution = "">
  261. <cfset resolution_date = "">
  262. <cfset resolution_verified_by = "">
  263. <cfset verification_date = "">
  264. <cfset dept_responsibility = "">
  265. <cfset rma_data = "">
  266. <cfinclude template="serialdisplay.cfm">
  267. </cfif>
  268. <!---
  269. <cfset count = 0>
  270. <cfoutput query="parts">
  271. <cfset count = count + 1>
  272. <div id="partscount#count#">
  273.  
  274. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  275. <tr>
  276. <td class="indent" id="formfieldpadding">Follow up Date:(MM/DD/YYYY)&nbsp;&nbsp;&nbsp;
  277. <input type="text" name="followdate_#count#" value="" size="8"/>&nbsp;&nbsp;&nbsp;
  278. Current Date<input type="checkbox" name="followcheck_#count#" value="" onClick="followdate.value=fill_date()"/></td>
  279. <td>On Site:</td>
  280. <td><select name="onsite_#count#">
  281. <option value="No Choice" selected>No Choice</option>
  282. <option value="Yes">Yes</option>
  283. <option value="No">No</option>
  284. </select><td>
  285. <td># of Onsite:</td><td><select name="numonsite_#count#">
  286. <option value="" selected>No Choice</option>
  287. <cfloop from="0" to="10" index="nonsite"><cfoutput>
  288. <option value="#nonsite#">#nonsite#</option></cfoutput></cfloop>
  289. </select><td>
  290. </tr>
  291. </table>
  292. <input type="hidden" name="serialcount" value="#count#">
  293.  
  294.  
  295.  
  296.  
  297. <!--- Parts Information, display parts if have or don't have a value --->
  298. <cfoutput query="parts">
  299. <cfset hc_partNo = #hc_partNo#>
  300. <cfset part_returned = #part_returned#>
  301. <cfset defective = #defective#>
  302. <cfinclude template="partsdisplay.cfm">
  303. </cfoutput>
  304. <cfif parts.recordcount is 0>
  305. <cfset hc_partNo = "">
  306. <cfset part_returned = "">
  307. <cfset defective = "">
  308. <cfoutput><cfinclude template="partsdisplay.cfm"></cfoutput>
  309. </cfif>
  310.  
  311. ---></div>
  312.      <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
  313.  
an here is the javascript

Expand|Select|Wrap|Line Numbers
  1. <!---Allows us to add serial information multiple times --->
  2. <script type="text/javascript">
  3. <!---Allows us to add multiple fields --->
  4. function addInput(divName){
  5. var dynamic = document.getElementById('dynamicInput');
  6. var thevalue = document.getElementById('theValue');
  7. var count = (document.getElementById('theValue').value -1)+ 2;
  8. thevalue.value = count;
  9. var newdiv = document.createElement('div');
  10. var getparts = document.createElement('div');
  11. var divIdName = 'dynamic'+count+'Input';
  12. var partc = 'partscount'+count;
  13.  
  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>
Thank you,
Rach
Oct 20 '08 #29

acoder
Expert Mod 15k+
P: 16,027
For the add/delete functionality to work, you need to make sure the counts match up. So if there are three, the count has to be 3 and the divs IDs/field names all have to be correct. Check the add functions to see how the naming works and make sure the display from Coldfusion is the same.
Oct 20 '08 #30

100+
P: 769
For the add/delete functionality to work, you need to make sure the counts match up. So if there are three, the count has to be 3 and the divs IDs/field names all have to be correct. Check the add functions to see how the naming works and make sure the display from Coldfusion is the same.
Hey Acoder,

I get what your saying. I got it removing and adding. But the parts is not counting right.Right now i am testing it on 2 serials both with a part applied to it. An the first serial with the first part counts correctly. But the second part with the second serial does not. It counts 1 an then it goes to 3, no 2 in between. Here 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.  
  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="partscount#count#" id="partscount#count#" value="#count#">
  179. <input type="hidden" name="serialcount" id="serialcount" value="#count#">
  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" 
  190. onclick="addpartInput('dynamic#count#Input')">
  191. </td>
  192. </tr>
  193. </table>
  194.  
  195.  
  196. <!---Shows what was previously entered into parts table--->
  197. <!---dbtype="query"--->
  198. <cfquery name="getparts" dbtype="query" >
  199. SELECT *
  200. FROM parts
  201. WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
  202. cfsqltype="cf_sql_char" maxLength="20">
  203. </cfquery>
  204. <cfset count1 = 0>
  205. <!---<cfif serial.recordcount is 0>--->
  206. <cfloop query="getparts">
  207. <cfset count1 = count1 + 1>
  208. <div id="part#count1#Name#count1#">
  209. <!---THIS IS THE PARTS SECTION--->
  210. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  211. <th class="sectiontitle" colspan="7">Parts Information #count1# Serial Information #count#</th>
  212. <tr>
  213. <td class='indent' id='formfieldpadding'>HC P/N:&nbsp;&nbsp;&nbsp;<input type='text' name="hcpn_#count1#" style="margin:0px" value="#hc_partNo#"></td>
  214. <td class="red">
  215. Parts been returned*
  216. <input type="checkbox" name="partsreturn_#count1#" value="#part_returned#"<cfif #part_returned# eq "1">checked=yes</cfif>/>
  217. </td>
  218. <td>
  219. <td class="indent">Defective<input type="checkbox" name="defective_#count1#" value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/></td>
  220. </td>
  221. </tr>
  222. </table>
  223.  
  224. <!--- Adds Delete to every ticket  --->
  225. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  226. <tr>
  227. <td>
  228. <input type="button" class="removeticket" value="Remove Parts #count1#" 
  229. onclick="removetheElement('part#count1#Name#count1#')"></a>
  230. </td>
  231. </td>
  232. </tr>
  233. </table>
  234. </div>
  235. </cfloop>
  236. </div>
  237. </cfoutput>
  238. <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
  239.  
  240.  
  241. <!---If have any blanks in serial table it will make field appear--->
  242. <cfoutput query="serial">
  243. <cfset model_no = #model_no#>
  244. <cfset product_type = #product_type#>
  245. <cfset type_hardware_failure = #type_hardware_failure#>
  246. <cfset pka_serialNo = #pka_serialNo#>
  247. <cfset software_hardware = #software_hardware#>
  248. <cfset description = #description#>
  249. <cfset resolution = #resolution#>
  250. <cfset resolution_date = #resolution_date#>
  251. <cfset resolution_verified_by = #resolution_verified_by#>
  252. <cfset verification_date = #verification_date#>
  253. <cfset dept_responsibility = #dept_responsibility#>
  254. <cfset rma_data = #rma_data#>
  255. </cfoutput>
  256. <cfif serial.recordcount is 0>
  257. <cfset model_no = "">
  258. <cfset product_type = "">
  259. <cfset type_hardware_failure = "">
  260. <cfset pka_serialNo = "">
  261. <cfset software_hardware = "">
  262. <cfset description = "">
  263. <cfset resolution = "">
  264. <cfset resolution_date = "">
  265. <cfset resolution_verified_by = "">
  266. <cfset verification_date = "">
  267. <cfset dept_responsibility = "">
  268. <cfset rma_data = "">
  269. <cfinclude template="serialdisplay.cfm">
  270. </cfif>
  271. <!---
  272. <cfset count = 0>
  273. <cfoutput query="parts">
  274. <cfset count = count + 1>
  275. <div id="partscount#count#">
  276.  
  277. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  278. <tr>
  279. <td class="indent" id="formfieldpadding">Follow up Date:(MM/DD/YYYY)&nbsp;&nbsp;&nbsp;
  280. <input type="text" name="followdate_#count#" value="" size="8"/>&nbsp;&nbsp;&nbsp;
  281. Current Date<input type="checkbox" name="followcheck_#count#" value="" onClick="followdate.value=fill_date()"/></td>
  282. <td>On Site:</td>
  283. <td><select name="onsite_#count#">
  284. <option value="No Choice" selected>No Choice</option>
  285. <option value="Yes">Yes</option>
  286. <option value="No">No</option>
  287. </select><td>
  288. <td># of Onsite:</td><td><select name="numonsite_#count#">
  289. <option value="" selected>No Choice</option>
  290. <cfloop from="0" to="10" index="nonsite"><cfoutput>
  291. <option value="#nonsite#">#nonsite#</option></cfoutput></cfloop>
  292. </select><td>
  293. </tr>
  294. </table>
  295. <input type="hidden" name="serialcount" value="#count#">
  296.  
  297.  
  298.  
  299.  
  300. <!--- Parts Information, display parts if have or don't have a value --->
  301. <cfoutput query="parts">
  302. <cfset hc_partNo = #hc_partNo#>
  303. <cfset part_returned = #part_returned#>
  304. <cfset defective = #defective#>
  305. <cfinclude template="partsdisplay.cfm">
  306. </cfoutput>
  307. <cfif parts.recordcount is 0>
  308. <cfset hc_partNo = "">
  309. <cfset part_returned = "">
  310. <cfset defective = "">
  311. <cfoutput><cfinclude template="partsdisplay.cfm"></cfoutput>
  312. </cfif>
  313.  
  314. ---></div>
  315.      <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
Thank you,
Rach
Oct 20 '08 #31

acoder
Expert Mod 15k+
P: 16,027
Where you're setting the ID: "part#count1#Name#count1#" it should be #count# for one of them. If you remember, it uses the parts count and the serial count.
Oct 20 '08 #32

100+
P: 769
Where you're setting the ID: "part#count1#Name#count1#" it should be #count# for one of them. If you remember, it uses the parts count and the serial count.
Hey Acoder,

So this one would be correct right?

Expand|Select|Wrap|Line Numbers
  1. <div id="part#count1#Name#count#">
i looked and compared the insert to the edit. An the only thing different i can see is when you look at dynamic 2 in my insert it does this

Expand|Select|Wrap|Line Numbers
  1. <input id="partscount2" type="hidden" value="1" name="partscount2"/>
  2. <input id="serialcount" type="hidden" value="2" name="serialcount"/>
and in my edit it does this

Expand|Select|Wrap|Line Numbers
  1. <input id="partscount2" type="hidden" value="2" name="partscount2"/>
  2. <input id="serialcount" type="hidden" value="2" name="serialcount"/>
also noticed if you look at the first dynamic input and look at the add parts and remove serial it says this

this is what it looks like for creating

Expand|Select|Wrap|Line Numbers
  1. <input class="removeticket" type="button" onclick="removeElement('dynamic1Input')" value="Remove Serial "1""/>
  2. </td>
  3. </tr>
  4. <tr>
  5. <td>
  6. <input class="addticket" type="button" onclick="addpartInput('dynamic1Input')" value="Add Parts"/>
an this is what it looks like in edit

Expand|Select|Wrap|Line Numbers
  1. <input class="removeticket" type="button" onclick="removeElement('dynamic1Input')" value="Remove Serial 1"/>
  2. </td>
  3. </tr>
  4. <tr>
  5. <td>
  6. <input class="addticket" type="button" onclick="addpartInput('dynamic0Input')" value="Add Parts"/>
do i need to create another count in the serial section so that adding parts will act right?

Thank you,
Rach
Oct 20 '08 #33

acoder
Expert Mod 15k+
P: 16,027
No, just make sure that #count# is always used for serial counting and #count1# for parts counting.
Oct 20 '08 #34

100+
P: 769
Hey Acoder,


I figured it out. This line needed to be in the parts div instead of the serial div.

Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#">
but i have now ran into another problem with the inserting. When i was testing it. I accidentally deleted one of the parts an so instead of parts 1 parts 2 parts 3 i had
parts 1 parts 3 an when i submitted i got the following error

Error Diagnostic Information

An error occurred while evaluating the expression:


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


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

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

is there anyway for it to make it work where if a user deleted one it will still keep going. The serial one was able to work even if i user deleted the 2 out of it.

Thank you,
Rach
Oct 20 '08 #35

acoder
Expert Mod 15k+
P: 16,027
Ah, it seems it's using one count for all parts instead of a separate count for each set of parts in a particular serial. Make sure you have separate counts.
Oct 20 '08 #36

100+
P: 769
Ah, it seems it's using one count for all parts instead of a separate count for each set of parts in a particular serial. Make sure you have separate counts.
Hey Acoder,

yeah i figured out its problem wanted the hidden parts count in the parts section. an forgot to add the count for serial behind each field (like we did in the parts section of javascript).But now i am having problems with the insert of parts again see above.

Thank you,
Rach
Oct 20 '08 #37

acoder
Expert Mod 15k+
P: 16,027
Well done. I guess I replied too early ;)

As for the new problem, to solve it, you could copy the values from the later parts to the deleted part and above and delete the last one. Do you see how that would work?
Oct 20 '08 #38

100+
P: 769
Well done. I guess I replied too early ;)

As for the new problem, to solve it, you could copy the values from the later parts to the deleted part and above and delete the last one. Do you see how that would work?
Hey Acoder,

You definately lost me on that one. An the thing is the user might add for example 5 parts an delete 2 and 4 an then it be 1,3,and 5 left. So i don't know if just deleting the last one would work.An i just noticed something else (sigh) but when i didn't add any parts and added 2 serials an clicked submit it brought up the error

An error occurred while evaluating the expression:


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


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

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

an sadly thats not good either cause sometimes the user might not add any parts. Any ideas?

Thank you :),
Rach
Oct 20 '08 #39

acoder
Expert Mod 15k+
P: 16,027
Let me explain how that would work with an example. If you have five parts and want to delete no.2 and move 3 to 2, 4 to 3 and 5 to 4 then delete the last one, all the parts will be intact and no. 2 will be removed. That may seem a lot of work, but with a loop it's not as much as you think.

That's one option. Another option is to store the numbers of the parts and delete part numbers from that field. You can use the field value in place of a count because it would be a list and you can use listlen to get the count. This would probably be the easier solution.
Oct 21 '08 #40

100+
P: 769
Let me explain how that would work with an example. If you have five parts and want to delete no.2 and move 3 to 2, 4 to 3 and 5 to 4 then delete the last one, all the parts will be intact and no. 2 will be removed. That may seem a lot of work, but with a loop it's not as much as you think.

That's one option. Another option is to store the numbers of the parts and delete part numbers from that field. You can use the field value in place of a count because it would be a list and you can use listlen to get the count. This would probably be the easier solution.
Hey Acoder,

Well whatever way you think would be the best way. The only thing with the first suggestion i am worried about is this. What if they delete 2 fields. Instead of just no 2, lets say we have 5 total fields an we delete 2 and 4 then would all the remaining fields become 1, 2 and 3 or would it remain like 1,2,3,5? mostly what i am worried about is them deleting more then one field. But whatever way you think would be best then lets start with that.

Thank you :),
Rach
Oct 21 '08 #41

acoder
Expert Mod 15k+
P: 16,027
That shouldn't be a problem because only one part would be deleted at a time.

I think, however, that the second solution may make more sense here (even though it would involve changing some of the code that does the inserting). The advantage of the first approach is that you only need to change in one place. The second method seems easier though.

Is it necessary that part numbers should go from 1 to, say, 3 instead of having gaps?
Oct 21 '08 #42

100+
P: 769
That shouldn't be a problem because only one part would be deleted at a time.

I think, however, that the second solution may make more sense here (even though it would involve changing some of the code that does the inserting). The advantage of the first approach is that you only need to change in one place. The second method seems easier though.

Is it necessary that part numbers should go from 1 to, say, 3 instead of having gaps?
Hey Acoder,

Well the thing is if it has gaps, is when it runs into problems. When i inserted parts 1, and parts 3. It was going we can't find 2 and can not insert into the database.It basically has a fit when its missing a number.

I also i got another problem i wanted to ask on. I ran into the problem where i didn't select any parts at all to upload and got the same error i got for not upload the parts in order saying

Expand|Select|Wrap|Line Numbers
  1. An error occurred while evaluating the expression: 
  2.  
  3.  
  4.  hcpn            = Form["hcpn_" & ps & "_#machinecount#"]
  5.  
  6.  
  7. Error near line 96, column 8.
  8. --------------------------------------------------------------------------------
  9.  
  10. The member "HCPN_1_1" in dimension 1 of object "Form" cannot be found. Please, modify the member name
is there a way to make it not insert a part if a part was not selected?

Thank you,
Rach
Oct 21 '08 #43

acoder
Expert Mod 15k+
P: 16,027
I understand that, but I meant gaps in the numbering for display, e.g. would it be a problem to have part 1 displayed, then part 3 when adding/deleting parts? Of course, this would be academic when you get round to displaying later which will be sorted out.

For no parts, you can validate based on the count.
Oct 21 '08 #44

100+
P: 769
I understand that, but I meant gaps in the numbering for display, e.g. would it be a problem to have part 1 displayed, then part 3 when adding/deleting parts? Of course, this would be academic when you get round to displaying later which will be sorted out.

For no parts, you can validate based on the count.
Hey Acoder,

Based on what i know i don't think it would be a problem as long as it wouldn't affect how it displayed back later Because how it displays back doesn't have to be parts 1, parts 3. It can just be parts 1 parts 2. But how would i validate the count?

Thank you,
Rach
Oct 21 '08 #45

acoder
Expert Mod 15k+
P: 16,027
Actually, I don't think you should need to validate the count if your loop has been written correctly and the count is correct. What code do you have currently for inserting parts?
Oct 21 '08 #46

100+
P: 769
Actually, I don't think you should need to validate the count if your loop has been written correctly and the count is correct. What code do you have currently for inserting parts?
Hey Acoder,

Here is what i have for inserting

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>
and here is what i have when i submit the form. was not sure if you wanted this but thought i would include it just in case

Expand|Select|Wrap|Line Numbers
  1. <!---Inserts information into serial table.--->
  2. <CFIF REQUEST_METHOD EQ "POST">
  3. <CFSET machineListLen = listLen(Form.serialcount)>
  4. <CFLOOP from="1" to="#machineListLen#" index="machineCount">
  5.  <CFSET serialnum       = Form["serialnum_" & machineCount]>
  6.  <CFSET modelno         = Form["modelno_" & machineCount]>
  7.  <CFSET producttype     = Form["producttype_" & machineCount]>
  8.  <CFSET softhardware    = Form["softhardware_" & machineCount]>
  9.  <CFSET resolution      = Form["resolution_" & machineCount]>
  10.  <CFSET resdate         = Form["resdate_" & machineCount]>
  11.  <CFSET resvertified    = Form["resvertified_" & machineCount]>
  12.  <CFSET vertifidate     = Form["vertifidate_" & machineCount]>
  13.  <CFSET deptvendor      = Form["deptvendor_" & machinecount]>
  14.  <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
  15.  <CFSET rma             = Form["rma_" & machineCount]>
  16.  <CFSET thedescription  = Form["thedescription_" & machineCount]>
  17. <!--- <CFSET followdate      = Form["followdate_" & machineCount]>
  18.  <CFSET onsite          = Form["onsite_" & machineCount]>
  19.  <CFSET numonsite       = Form["numonsite_" & machineCount]>--->
  20.  
  21.  <!--- inserts information into the serial table--->
  22. <cfquery name="serial" datasource="CustomerSupport">
  23.    exec usp_CS_Insertserial 
  24.      <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  25.      '#Form.ID#',
  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.      <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">
  36.    </cfquery>
  37.  
  38. <!---Inserts information into notes_descr table.--->
  39. <cfquery name="description" datasource="CustomerSupport">
  40.     exec usp_CS_Insertdescription
  41.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  42.    '#Form.ID#',
  43.    <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
  44.    '#Form.fk_addedBy#'
  45. </cfquery>
  46.  
  47.  
  48. <!---Inserts parts information into parts table.--->
  49. <!---because it is a bit we don't use 'ticks' around defective for parts table--->
  50. <cfloop from="1" to="#form['partscount' & machinecount]#" index="ps">
  51. <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
  52. <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
  53.  <CFSET hcpn            = Form["hcpn_" & ps & "_#machinecount#"]>
  54.  <CFSET partsreturn     = Form["partsreturn_" & ps & "_#machinecount#"]>
  55.  <CFSET defective       = Form["defective_" & ps & "_#machinecount#"]>
  56. <cfquery name="parts" datasource="CustomerSupport">
  57.     exec usp_CS_Insertparts
  58.     <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  59.     '#Form.ID#',
  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.    '#Form.submission#'
  64. </cfquery>
  65. </cfloop>
  66. </CFLOOP>
  67. </CFIF>
Thank you,
Rach
Oct 21 '08 #47

acoder
Expert Mod 15k+
P: 16,027
It was actually the Coldfusion code I was looking for. See this line:
Expand|Select|Wrap|Line Numbers
  1. <cfloop from="1" to="#form['partscount' & machinecount]#" index="ps">
If the parts count is 0, then there's no loop. Make sure the count is 0 when there are no parts.
Oct 21 '08 #48

100+
P: 769
It was actually the Coldfusion code I was looking for. See this line:
Expand|Select|Wrap|Line Numbers
  1. <cfloop from="1" to="#form['partscount' & machinecount]#" index="ps">
If the parts count is 0, then there's no loop. Make sure the count is 0 when there are no parts.
Hey Acoder,

Well that makes perfect since :). But ok so how do we make it so that parts count or not count missing parts?

Thank you,
Rach
Oct 21 '08 #49

acoder
Expert Mod 15k+
P: 16,027
Does this problem occur when no parts have been added at all or when you add a part and then delete it (leaving no parts)?
Oct 21 '08 #50

482 Replies

Post your reply

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