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

Home Posts Topics Members FAQ

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

displaying previously entered multiple fields

769 512MB
Hey Everyone,

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

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

Currently this is what it does

serial information 1
parts 1
parts 2

serial information 2
parts 1
parts 2

and what it needs to do

serial information 1
parts 1
serial information 2
parts 1

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

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


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

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


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

Just one thing though: couldn't you have more than one description per serial? If so, you need to treat it like parts.
Nov 20 '08 #351
bonneylake
769 512MB
That seems the most likely explanation. You need to change that stored procedure to an insert/update one like serials and parts.

Just one thing though: couldn't you have more than one description per serial? If so, you need to treat it like parts.
Hey Acoder,

I realized i can't make the description an update. Theres a field in the description called fk_addedBy and basically whoever adds a description there name will be applied to the description. Well if i update it no matter if they mess with the description or not it puts the name of the person who updated the ticket last name instead of the person who actually submitted the description in the first place. So basically if i put the description as a update it will take the person who original added a description an take there name out an put who ever last updated the tickets name and apply it to each description.So i not sure how i can go around that unless you have an idea?

But yes the description can have more then one applied to it. So i am going to try an treat it like parts an see what happens.

Thank you :),
Rach
Nov 20 '08 #352
acoder
16,027 Expert Mod 8TB
So basically if i put the description as a update it will take the person who original added a description an take there name out an put who ever last updated the tickets name and apply it to each description.So i not sure how i can go around that unless you have an idea?
Why not change the update query to only update the other fields and not the added by? In the part which checks if it should be an update or an insert, only add a check for the ther fields and not added-by.
Nov 20 '08 #353
bonneylake
769 512MB
Why not change the update query to only update the other fields and not the added by? In the part which checks if it should be an update or an insert, only add a check for the ther fields and not added-by.
Hey Acoder,

Are you saying that when i created my update/insert stored procedure for description. To just not to add fk_addedBy? Or are you saying to keep fk_addedBy out of the update, but not out of the insert part of the stored procedure? If your talking about either i tried the following but although its not updateing the fk_addedBy its still updateing the description so if i change the description it changes as well instead of adding a new one here is what i have.


Expand|Select|Wrap|Line Numbers
  1. set ANSI_NULLS ON
  2. set QUOTED_IDENTIFIER ON
  3. go
  4.  
  5.  
  6.  
  7. -- =============================================
  8. -- Author:        <Author,,Name>
  9. -- Create date: <Create Date,,>
  10. -- Description:    <Description,,>
  11. -- =============================================
  12. ALTER PROCEDURE [dbo].[usp_CS_Updatedescription]
  13. -- Add the parameters for the stored procedure here
  14.          (@fk_serialNo nvarchar(50),
  15.     @fk_ticketNo numeric(18,0),
  16.     @description nvarchar(1000),
  17.     @fk_addedBy nvarchar(100))
  18. AS
  19. BEGIN
  20.        --- SET should be the first statement .. before everything else
  21.     -- SET NOCOUNT ON added to prevent extra result sets from
  22.     -- interfering with SELECT statements.
  23.     SET NOCOUNT ON;
  24.  
  25.     DECLARE @pk_num int
  26.  
  27.  
  28.     -- If @fk_custNum already exists, get the pk_contactID
  29.     SELECT @pk_num = ( SELECT MAX(pk_num) FROM dbo.tbl_CS_notes_descr WHERE fk_serialNo = @fk_serialNo and  fk_ticketNo=@fk_ticketNo)
  30.  
  31.     -- If  @fk_custNum already exists in the table, update it
  32.     IF @pk_num IS NOT NULL
  33.     BEGIN
  34.  
  35.             UPDATE    dbo.tbl_CS_notes_descr
  36.             SET       
  37.                      fk_ticketNo=@fk_ticketNo,
  38.                      description=@description
  39.  
  40.  
  41.  
  42.  
  43.             WHERE    (pk_num = @pk_num and fk_serialNo = @fk_serialNo and  fk_ticketNo=@fk_ticketNo)
  44.  
  45.     END
  46.     -- the @fk_custNum does NOT exist. insert a new record
  47.     ELSE
  48.     BEGIN
  49.  
  50.  
  51.         -- Insert statements for procedure here
  52. insert into dbo.tbl_CS_notes_descr
  53.     (pk_num,fk_serialNo,fk_ticketNo,description,fk_addedBy)
  54.  
  55.     values
  56.     (@pk_num,@fk_serialNo,@fk_ticketNo,@description,@fk_addedBy)
  57.     END
  58.  
  59.  
  60.     SET NOCOUNT OFF
  61. END
  62.  
here is what i got for description to be treated like parts is but i am unsure of where the sections for descriptions goes.

Expand|Select|Wrap|Line Numbers
  1. <CFIF REQUEST_METHOD EQ "POST">
  2.  
  3. <!---counts how many serials are there--->
  4.  <cfquery name="countserials" datasource="CustomerSupport">
  5. SELECT pka_serialNo from dbo.tbl_CS_serial where pkb_fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
  6.  </cfquery>
  7.  <cfset currSerialNo = 1>
  8.  
  9. <!--- the array gets serials that have been inserted and updated to avoid deleteing the ones that need to be inserted or updated--->
  10.  <cfset serialcheck = ArrayNew(1)>
  11. <!--- first loop inserts/update serials--->
  12.  <CFLOOP list="#form.serialcount#" index="machineCount">
  13. <CFSET serialnum       = Form["serialnum_" & machineCount]>
  14. <CFSET modelno         = Form["modelno_" & machineCount]>
  15. <CFSET producttype     = Form["producttype_" & machineCount]>
  16. <CFSET softhardware    = Form["softhardware_" & machineCount]>
  17. <CFSET resolution      = Form["resolution_" & machineCount]>
  18. <CFSET resdate         = Form["resdate_" & machineCount]>
  19. <CFSET resvertified    = Form["resvertified_" & machineCount]>
  20. <CFSET vertifidate     = Form["vertifidate_" & machineCount]>
  21. <CFSET deptvendor      = Form["deptvendor_" & machinecount]>
  22. <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
  23. <!---the array checks to see what serials are there--->
  24. <CFSET ArrayAppend(serialcheck, "#Form["serialnum_" & machineCount]#")> 
  25. <!--- counts how many parts are available--->
  26.  <cfquery name="countparts" datasource="CustomerSupport">
  27. SELECT pk_partID from dbo.tbl_CS_parts where fk_serialNo=<cfqueryparam value="#serialnum#"> and fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
  28.  </cfquery>
  29. <!--- the array gets parts that have been inserted and updated to avoid deleteing the ones that need to be inserted or updated--->
  30. <cfset partcheck = ArrayNew(1)>
  31.  
  32. DESCRIPTION
  33.  <!--- counts how many descriptions are available--->
  34.  <cfquery name="countdescription" datasource="CustomerSupport">
  35. SELECT pk_num from dbo.tbl_CS_notes_desc where fk_serialNo=<cfqueryparam value="#serialnum#"> and fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
  36.  </cfquery>
  37. <!--- the array gets description that have been inserted and updated to avoid deleteing the ones that need to be inserted or updated--->
  38. <cfset desccheck = ArrayNew(1)>
  39.  
  40.  <!--- inserts information into the serial table--->
  41.  <cfquery name="serialinsertupdate" datasource="CustomerSupport">
  42.     exec usp_CS_Updateinsertserial 
  43.      <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  44.      "#Form.pk_ticketID#",
  45.      <cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
  46.       <cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
  47.      <cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
  48.      <cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
  49.      <cfqueryparam value="#resdate#">,
  50.      <cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
  51.      <cfqueryparam value="#vertifidate#">,
  52.     <cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
  53.      <cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">   
  54.      </cfquery>
  55.  
  56. DESCRIPTION
  57.  <!---Inserts information into notes_descr table.--->
  58.  <CFSET thedescription  = Form["thedescription_" & machineCount]>
  59.  <!--- the pk_num makes each description added unique, this allows us to delete one descriptoin instead of all description associated with a serial--->
  60.  <CFSET pk_num = Form["pk_num_" & machinecount]>
  61.  <cfif thedescription neq "">
  62.   <cfquery name="description" datasource="CustomerSupport">
  63.     exec usp_CS_Insertdescription
  64.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  65.    '#Form.pk_ticketID#',
  66.     <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
  67.    '#Form.fk_addedBy#'
  68.  </cfquery>
  69.  </cfif>
  70.  
  71.   <!---Inserts  information into parts table.--->
  72.   <!---because it is a bit we don't use 'ticks' around defective for parts table--->
  73.  <cfparam name="form.partscount#machinecount#" default="">
  74.  <cfloop list="#form['partscount' & machinecount]#" index="ps">
  75.  <!--- the pkpartID makes each part added unique, this allows us to delete one part instead of all parts associated with a serial--->
  76.   <cfparam name="Form.pkpartID_#ps#_#machinecount#" default="">
  77.  <cfparam name="Form.hcpn_#ps#_#machinecount#" default="">
  78.  <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
  79.  <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
  80.  <cfparam name="Form.rma_#ps#_#machinecount#" default="">
  81. <!--- the pkpartID makes each part added unique, this allows us to delete one part instead of all parts associated with a serial--->
  82.  <CFSET pkpartID           = Form["pkpartID_" & "#ps#" & "_#machinecount#"]>
  83.  <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
  84.  <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
  85.  <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
  86.  <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
  87. <!---the array checks to see what parts are there--->
  88. <CFSET ArrayAppend(partcheck, "#Form["pkpartID_" & "#ps#" & "_#machinecount#"]#")>
  89. <!---if hcpn is not equal to blank (meaning if it doesn't have a value) it will not insert a part. However if hcpn 
  90. has a value it will insert the part into the table.--->
  91. <cfif hcpn neq "">
  92. <cfquery name="parts" datasource="CustomerSupport">
  93.    exec usp_CS_Updateinsertparts 
  94.   <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  95.    '#Form.pk_ticketID#',
  96.     <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
  97.     <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
  98.     <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
  99.    <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
  100.  </cfquery> 
  101.  <cfelse>
  102.  </cfif>
  103. </cfloop>
  104.  
  105. <!---THIS DELETES FOR THE PARTS TABLE--->
  106. <!---setting a list for parts--->
  107. <cfset partList = ArrayToList(partcheck, ",")>
  108. <!---when inserting/updating for part's table is done it then delete parts not being updated/inserted or was to be deleted on purpose--->
  109. <cfloop query="countparts">
  110. <cfset pk_partID= #pk_partID#>
  111. <!---if the part is not found in the list it begins deleteing--->
  112. <cfif not listFind(partList,pk_partID)>
  113. <cfquery name="deleteparts" datasource="CustomerSupport">
  114. exec usp_CS_Deleteparts
  115. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  116. '#Form.pk_ticketID#'
  117. </cfquery>
  118. </cfif>
  119. </cfloop>
  120.  
  121. <!---THIS DELETES FOR THE DESCRIPTION TABLE--->
  122. <cfset descriptionList = ArrayToList(desccheck, ",")>
  123. <!---when inserting/updating for part's table is done it then delete parts not being updated/inserted or was to be deleted on purpose--->
  124. <cfloop query="countdescription">
  125. <cfset pk_num= #pk_num#>
  126. <!---if the part is not found in the list it begins deleteing--->
  127. <cfif not listFind(descriptionList,pk_num)>
  128. <cfquery name="deletedescription" datasource="CustomerSupport">
  129. exec usp_CS_Deletenotesdescription
  130. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  131. '#Form.pk_ticketID#'
  132. </cfquery
  133. </cfif>
  134.  
  135. </CFLOOP>
  136.  
  137. <!---THIS DELETES FOR SERIAL TABLE AND ANY PARTS ASSOCIATED WITH THE SERIAL--->
  138. <!---setting a list for serial--->
  139. <cfset serialList = ArrayToList(serialcheck, ",")>
  140. <!---when inserting/updating for serial's table is done it then delete serials not being updated/inserted or was to be deleted on purpose--->
  141. <cfloop query="countserials">
  142. <CFSET serialnum = #pka_serialNo#>
  143. <!---if the serial is not found in the list it begins deleteing--->
  144. <cfif not listFind(serialList,serialnum)>
  145. <cfquery name="deleteserialparts" datasource="CustomerSupport">
  146. exec usp_CS_Deleteserialparts   
  147. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  148. '#Form.pk_ticketID#'
  149. </cfquery>
  150. <!---<cfquery name="deletedescription" datasource="CustomerSupport">
  151. exec usp_CS_Deletenotesdescription
  152. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  153. '#Form.pk_ticketID#'
  154. </cfquery>--->
  155. </cfif>
  156. </cfloop>
  157.  
Thank you,
Rach
Nov 20 '08 #354
acoder
16,027 Expert Mod 8TB
Are you saying that when i created my update/insert stored procedure for description. To just not to add fk_addedBy? Or are you saying to keep fk_addedBy out of the update, but not out of the insert part of the stored procedure? If your talking about either i tried the following but although its not updateing the fk_addedBy its still updateing the description so if i change the description it changes as well instead of adding a new one here is what i have.
Is that what you wanted?

The description should be very similar to parts, so you will need something to uniquely identify a single description.
Nov 20 '08 #355
bonneylake
769 512MB
Is that what you wanted?

The description should be very similar to parts, so you will need something to uniquely identify a single description.
Hey Acoder,

actually yes it does, i realized i forgot a few things an now its the same problem but it makes more sense just not sure on the solution. Well now the problem i have is. The way we do the other fields is we check if it already has a value and it updates it. The thing is though i don't display the description like i do all serial or parts. on the cticketpage2edit.cfm page i display it like so.

Expand|Select|Wrap|Line Numbers
  1. <cfquery name="getnotes" dbtype="query" >
  2. SELECT *
  3. FROM notes
  4. WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
  5. cfsqltype="cf_sql_char" maxLength="20">
  6. </cfquery>
  7. <cfloop query="getnotes">
  8. <input type="hidden" name="pk_num_#count#" id="pk_num" value="#pk_num#" />
  9. #description#</cfloop>
an basically unless the value is in the following below. It will a)delete the value i already had and b) will not add another value into the textarea below if i add another

Expand|Select|Wrap|Line Numbers
  1. <textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60']name="thedescription_#count#"></textarea> 
any ideas to go around this? i tried just doing a hidden field with the value of #description# but it didn't work to well.

Thank you,
Rach
Nov 20 '08 #356
acoder
16,027 Expert Mod 8TB
Is the table name tbl_CS_notes_descr or just notes?

So, does that mean that you can't edit a description already entered? If there are, for example, 5 descriptions already for that serial, you can't edit or delete any of them- you can only add. Is that correct?
Nov 21 '08 #357
bonneylake
769 512MB
Hey Acoder,

Yes the table name for description is tbl_CS_notes_descr.An yes basically can't edit or delete a description already entered. Basically the description keeps up with what is going on with whatever they are working on so say for example

nov/11/08 jane
customer called complaining hard drive is not working. working on getting parts for it
nov/15/08 stefan
got the part for it working on sending it

its basically to know who to blame if something goes wrong or something does not get done. atleast that is how i think of it lol. But is there a way to just put a hidden field on there an it knows what the value is based on the hidden field?

Thank you :),
Rach
Nov 21 '08 #358
acoder
16,027 Expert Mod 8TB
Now I notice that notes is the name of a Coldfusion query, not a table name.

If no description can be deleted or edited, then you only need to worry about deletions when a serial is deleted (though ideally that shouldn't even be a problem because the foreign key should be taking care of that). Use the serial numbers to delete all descriptions. Since you can't edit, there's no need for updates - just inserts will do. Is there an option to insert more than one description at any one time?
Nov 21 '08 #359
bonneylake
769 512MB
Now I notice that notes is the name of a Coldfusion query, not a table name.

If no description can be deleted or edited, then you only need to worry about deletions when a serial is deleted (though ideally that shouldn't even be a problem because the foreign key should be taking care of that). Use the serial numbers to delete all descriptions. Since you can't edit, there's no need for updates - just inserts will do. Is there an option to insert more than one description at any one time?
Hey Acoder,

The only way a person can add another description is when they go to edit. For example lets say they inserted a serial and added a description to that serial. They then go back to edit the description. They will see the description that was previously added (by clicking on another link or by me displaying it on the page). They will not be able to change the description previously enter. However, they will still see the textarea for description under the pacific serial an will be able to add another description to that particular serial. So basically they will be able to add a description that way. But besides that they can not do like we do with serial where they can add multiple serials or parts.

but basically for my description i should be deleteing like this an then does the description delete need to be in the part loop, serial loop, or on its own like we do serial delete?

Expand|Select|Wrap|Line Numbers
  1. <cfset descriptionList = ArrayToList(desccheck, ",")>
  2. <!---when inserting/updating for part's table is done it then delete parts not being updated/inserted or was to be deleted on purpose--->
  3. <cfloop query="countdescription">
  4. <cfset pk_num= #pk_num#>
  5. <!---if the part is not found in the list it begins deleteing--->
  6. <cfif not listFind(descriptionList,pk_num)>
  7. <cfquery name="deletedescription" datasource="CustomerSupport">
  8. exec usp_CS_Deletenotesdescription
  9. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  10. </cfquery>
  11. </cfif>
  12. </cfloop>
  13.  
Thank you :),
Rach
Nov 21 '08 #360
acoder
16,027 Expert Mod 8TB
You don't need a descCheck array for descriptions or any array appending because you can just use the serial one. When you delete a serial, delete all the corresponding descriptions (put the query in the cfif)
Nov 21 '08 #361
bonneylake
769 512MB
You don't need a descCheck array for descriptions or any array appending because you can just use the serial one. When you delete a serial, delete all the corresponding descriptions (put the query in the cfif)
Hey Acoder,

Would i still do the cfloop that i use to count the description or would i take it out?
here is what i have right now

Expand|Select|Wrap|Line Numbers
  1. <!---THIS DELETES FOR SERIAL TABLE AND ANY PARTS ASSOCIATED WITH THE SERIAL--->
  2. <!---setting a list for serial--->
  3. <cfset serialList = ArrayToList(serialcheck, ",")>
  4. <!---when inserting/updating for serial's table is done it then delete serials not being updated/inserted or was to be deleted on purpose--->
  5. <cfloop query="countserials">
  6. <CFSET serialnum = #pka_serialNo#>
  7. <!---if the serial is not found in the list it begins deleteing--->
  8. <cfif not listFind(serialList,serialnum)>
  9. <cfquery name="deleteserialparts" datasource="CustomerSupport">
  10. exec usp_CS_Deleteserialparts   
  11. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  12. '#Form.pk_ticketID#'
  13. </cfquery>
  14. <!---THIS DELETES FOR THE DESCRIPTION TABLE--->
  15. <cfset serialList = ArrayToList(serialcheck, ",")>
  16. <!---when inserting/updating for part's table is done it then delete parts not being updated/inserted or was to be deleted on purpose--->
  17. <cfloop query="countdescription">
  18. <CFSET serialnum = #pka_serialNo#>
  19. <!---if the part is not found in the list it begins deleteing--->
  20. <cfquery name="deletedescription" datasource="CustomerSupport">
  21. exec usp_CS_Deletenotesdescription
  22. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  23. <!---'#Form.pk_ticketID#'--->
  24. </cfquery>
  25. </cfloop>
  26. </cfif>
  27. </cfloop>
Thank you,
Rach
Nov 21 '08 #362
acoder
16,027 Expert Mod 8TB
You don't need any of the duplicate code. You just need to put the query right next to/below the serial delete query with the same parameters passed (same ticket and serial numbers).
Nov 21 '08 #363
bonneylake
769 512MB
You don't need any of the duplicate code. You just need to put the query right next to/below the serial delete query with the same parameters passed (same ticket and serial numbers).
Hey Acoder,

Well i am still doing something wrong. Right now what happens is i can insert a description just fine. An when i go to edit it i can see what i added just fine. But when i go to add another description it deletes the previously submitted description an does not insert another one although i did not delete the serial. Here is what i got in full

Expand|Select|Wrap|Line Numbers
  1. <CFIF REQUEST_METHOD EQ "POST">
  2.  
  3. <!---counts how many serials are there--->
  4.  <cfquery name="countserials" datasource="CustomerSupport">
  5. SELECT pka_serialNo from dbo.tbl_CS_serial where pkb_fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
  6.  </cfquery>
  7.  <cfset currSerialNo = 1>
  8.  
  9. <!--- the array gets serials that have been inserted and updated to avoid deleteing the ones that need to be inserted or updated--->
  10.  <cfset serialcheck = ArrayNew(1)>
  11. <!--- first loop inserts/update serials--->
  12.  <CFLOOP list="#form.serialcount#" index="machineCount">
  13. <CFSET serialnum       = Form["serialnum_" & machineCount]>
  14. <CFSET modelno         = Form["modelno_" & machineCount]>
  15. <CFSET producttype     = Form["producttype_" & machineCount]>
  16. <CFSET softhardware    = Form["softhardware_" & machineCount]>
  17. <CFSET resolution      = Form["resolution_" & machineCount]>
  18. <CFSET resdate         = Form["resdate_" & machineCount]>
  19. <CFSET resvertified    = Form["resvertified_" & machineCount]>
  20. <CFSET vertifidate     = Form["vertifidate_" & machineCount]>
  21. <CFSET deptvendor      = Form["deptvendor_" & machinecount]>
  22. <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
  23. <CFSET thedescription  = Form["thedescription_" & machineCount]>
  24. <!---the array checks to see what serials are there--->
  25. <CFSET ArrayAppend(serialcheck, "#Form["serialnum_" & machineCount]#")> 
  26.  
  27.  
  28. <!--- counts how many parts are available--->
  29.  <cfquery name="countparts" datasource="CustomerSupport">
  30. SELECT pk_partID from dbo.tbl_CS_parts where fk_serialNo=<cfqueryparam value="#serialnum#"> and fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
  31.  </cfquery>
  32. <!--- the array gets parts that have been inserted and updated to avoid deleteing the ones that need to be inserted or updated--->
  33. <cfset partcheck = ArrayNew(1)>
  34.  
  35.  
  36.  <!--- inserts information into the serial table--->
  37.  <cfquery name="serialinsertupdate" datasource="CustomerSupport">
  38.     exec usp_CS_Updateinsertserial 
  39.      <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  40.      "#Form.pk_ticketID#",
  41.      <cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
  42.       <cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
  43.      <cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
  44.      <cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
  45.      <cfqueryparam value="#resdate#">,
  46.      <cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
  47.      <cfqueryparam value="#vertifidate#">,
  48.     <cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
  49.      <cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">   
  50.      </cfquery>
  51.  
  52.  <!---Inserts information into notes_descr table.--->
  53.  
  54.  <!--- the pk_num makes each description added unique, this allows us to delete one descriptoin instead of all description associated with a serial--->
  55. <!---<CFSET pk_num = Form["pk_num_" & machinecount]>--->
  56.   <cfquery name="description" datasource="CustomerSupport">
  57.     exec usp_CS_Insertdescription
  58.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  59.    '#Form.pk_ticketID#',
  60.     <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
  61.    '#Form.fk_addedBy#'
  62.  </cfquery>
  63.  
  64.   <!---Inserts  information into parts table.--->
  65.   <!---because it is a bit we don't use 'ticks' around defective for parts table--->
  66.  <cfparam name="form.partscount#machinecount#" default="">
  67.  <cfloop list="#form['partscount' & machinecount]#" index="ps">
  68.  <!--- the pkpartID makes each part added unique, this allows us to delete one part instead of all parts associated with a serial--->
  69.   <cfparam name="Form.pkpartID_#ps#_#machinecount#" default="">
  70.  <cfparam name="Form.hcpn_#ps#_#machinecount#" default="">
  71.  <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
  72.  <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
  73.  <cfparam name="Form.rma_#ps#_#machinecount#" default="">
  74. <!--- the pkpartID makes each part added unique, this allows us to delete one part instead of all parts associated with a serial--->
  75.  <CFSET pkpartID           = Form["pkpartID_" & "#ps#" & "_#machinecount#"]>
  76.  <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
  77.  <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
  78.  <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
  79.  <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
  80. <!---the array checks to see what parts are there--->
  81. <CFSET ArrayAppend(partcheck, "#Form["pkpartID_" & "#ps#" & "_#machinecount#"]#")>
  82. <!---if hcpn is not equal to blank (meaning if it doesn't have a value) it will not insert a part. However if hcpn 
  83. has a value it will insert the part into the table.--->
  84. <cfif hcpn neq "">
  85. <cfquery name="parts" datasource="CustomerSupport">
  86.    exec usp_CS_Updateinsertparts 
  87.   <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  88.    '#Form.pk_ticketID#',
  89.     <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
  90.     <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
  91.     <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
  92.    <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
  93.  </cfquery> 
  94.  <cfelse>
  95.  </cfif>
  96. </cfloop>
  97.  
  98. <!---THIS DELETES FOR THE PARTS TABLE--->
  99. <!---setting a list for parts--->
  100. <cfset partList = ArrayToList(partcheck, ",")>
  101. <!---when inserting/updating for part's table is done it then delete parts not being updated/inserted or was to be deleted on purpose--->
  102. <cfloop query="countparts">
  103. <cfset pk_partID= #pk_partID#>
  104. <!---if the part is not found in the list it begins deleteing--->
  105. <cfif not listFind(partList,pk_partID)>
  106. <cfquery name="deleteparts" datasource="CustomerSupport">
  107. exec usp_CS_Deleteparts
  108. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  109. '#Form.pk_ticketID#'
  110. </cfquery>
  111. </cfif>
  112. </cfloop>
  113.  
  114.  
  115.  
  116. </CFLOOP>
  117.  
  118. <!---THIS DELETES FOR SERIAL TABLE AND ANY PARTS ASSOCIATED WITH THE SERIAL--->
  119. <!---setting a list for serial--->
  120. <cfset serialList = ArrayToList(serialcheck, ",")>
  121. <!---when inserting/updating for serial's table is done it then delete serials not being updated/inserted or was to be deleted on purpose--->
  122. <cfloop query="countserials">
  123. <CFSET serialnum = #pka_serialNo#>
  124. <!---if the serial is not found in the list it begins deleteing--->
  125. <cfif not listFind(serialList,serialnum)>
  126. <cfquery name="deleteserialparts" datasource="CustomerSupport">
  127. exec usp_CS_Deleteserialparts   
  128. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  129. '#Form.pk_ticketID#'
  130. </cfquery>
  131. <!---if the part is not found in the list it begins deleteing--->
  132. <cfquery name="deletedescription" datasource="CustomerSupport">
  133. exec usp_CS_Deletenotesdescription
  134. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  135. '#Form.pk_ticketID#'
  136. </cfquery>
  137. <!---</cfloop>--->
  138. </cfif>
  139. </cfloop>
  140.  
  141.  
  142.  
  143. </CFIF>
Thank you,
Rach
Nov 21 '08 #364
acoder
16,027 Expert Mod 8TB
Is the edit submission page the same as the insert one?
Nov 21 '08 #365
bonneylake
769 512MB
Is the edit submission page the same as the insert one?
Hey Acoder,

This is the one on my insert submission page

Expand|Select|Wrap|Line Numbers
  1. <cfquery name="description" datasource="CustomerSupport">
  2.     exec usp_CS_Insertdescription
  3.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  4.    '#Form.ID#',
  5.    <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
  6.    '#Form.fk_addedBy#'
  7. </cfquery>
this is the oe on my edit submission page

Expand|Select|Wrap|Line Numbers
  1.   <cfquery name="description" datasource="CustomerSupport">
  2.     exec usp_CS_Insertdescription
  3.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  4.    '#Form.pk_ticketID#',
  5.     <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
  6.    '#Form.fk_addedBy#'
  7.  </cfquery>
Thank you,
Rach
Nov 21 '08 #366
acoder
16,027 Expert Mod 8TB
Does your InsertDescription stored procedure only insert?

The full page code you posted above was for the edit submission page then?
Nov 21 '08 #367
bonneylake
769 512MB
Does your InsertDescription stored procedure only insert?

The full page code you posted above was for the edit submission page then?
Hey Acoder,

Yes the insertdescription stored procedure only inserts

the first part i sent is for when you insert a description for the first time. The second part of the code is for when you edit the description an its also just an insert.If your talking about the code above that or what i just posted below. that is ONLY for the edit submission.
Expand|Select|Wrap|Line Numbers
  1. <CFIF REQUEST_METHOD EQ "POST">
  2.  
  3. <!---counts how many serials are there--->
  4.  <cfquery name="countserials" datasource="CustomerSupport">
  5. SELECT pka_serialNo from dbo.tbl_CS_serial where pkb_fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
  6.  </cfquery>
  7.  <cfset currSerialNo = 1>
  8.  
  9. <!--- the array gets serials that have been inserted and updated to avoid deleteing the ones that need to be inserted or updated--->
  10.  <cfset serialcheck = ArrayNew(1)>
  11. <!--- first loop inserts/update serials--->
  12.  <CFLOOP list="#form.serialcount#" index="machineCount">
  13. <CFSET serialnum       = Form["serialnum_" & machineCount]>
  14. <CFSET modelno         = Form["modelno_" & machineCount]>
  15. <CFSET producttype     = Form["producttype_" & machineCount]>
  16. <CFSET softhardware    = Form["softhardware_" & machineCount]>
  17. <CFSET resolution      = Form["resolution_" & machineCount]>
  18. <CFSET resdate         = Form["resdate_" & machineCount]>
  19. <CFSET resvertified    = Form["resvertified_" & machineCount]>
  20. <CFSET vertifidate     = Form["vertifidate_" & machineCount]>
  21. <CFSET deptvendor      = Form["deptvendor_" & machinecount]>
  22. <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
  23. <CFSET thedescription  = Form["thedescription_" & machineCount]>
  24. <!---the array checks to see what serials are there--->
  25. <CFSET ArrayAppend(serialcheck, "#Form["serialnum_" & machineCount]#")> 
  26.  
  27.  
  28. <!--- counts how many parts are available--->
  29.  <cfquery name="countparts" datasource="CustomerSupport">
  30. SELECT pk_partID from dbo.tbl_CS_parts where fk_serialNo=<cfqueryparam value="#serialnum#"> and fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
  31.  </cfquery>
  32. <!--- the array gets parts that have been inserted and updated to avoid deleteing the ones that need to be inserted or updated--->
  33. <cfset partcheck = ArrayNew(1)>
  34.  
  35.  
  36.  <!--- inserts information into the serial table--->
  37.  <cfquery name="serialinsertupdate" datasource="CustomerSupport">
  38.     exec usp_CS_Updateinsertserial 
  39.      <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  40.      "#Form.pk_ticketID#",
  41.      <cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
  42.       <cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
  43.      <cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
  44.      <cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
  45.      <cfqueryparam value="#resdate#">,
  46.      <cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
  47.      <cfqueryparam value="#vertifidate#">,
  48.     <cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
  49.      <cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">   
  50.      </cfquery>
  51.  
  52.  <!---Inserts information into notes_descr table.--->
  53.  
  54.  <!--- the pk_num makes each description added unique, this allows us to delete one descriptoin instead of all description associated with a serial--->
  55. <!---<CFSET pk_num = Form["pk_num_" & machinecount]>--->
  56.   <cfquery name="description" datasource="CustomerSupport">
  57.     exec usp_CS_Insertdescription
  58.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  59.    '#Form.pk_ticketID#',
  60.     <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
  61.    '#Form.fk_addedBy#'
  62.  </cfquery>
  63.  
  64.   <!---Inserts  information into parts table.--->
  65.   <!---because it is a bit we don't use 'ticks' around defective for parts table--->
  66.  <cfparam name="form.partscount#machinecount#" default="">
  67.  <cfloop list="#form['partscount' & machinecount]#" index="ps">
  68.  <!--- the pkpartID makes each part added unique, this allows us to delete one part instead of all parts associated with a serial--->
  69.   <cfparam name="Form.pkpartID_#ps#_#machinecount#" default="">
  70.  <cfparam name="Form.hcpn_#ps#_#machinecount#" default="">
  71.  <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
  72.  <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
  73.  <cfparam name="Form.rma_#ps#_#machinecount#" default="">
  74. <!--- the pkpartID makes each part added unique, this allows us to delete one part instead of all parts associated with a serial--->
  75.  <CFSET pkpartID           = Form["pkpartID_" & "#ps#" & "_#machinecount#"]>
  76.  <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
  77.  <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
  78.  <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
  79.  <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
  80. <!---the array checks to see what parts are there--->
  81. <CFSET ArrayAppend(partcheck, "#Form["pkpartID_" & "#ps#" & "_#machinecount#"]#")>
  82. <!---if hcpn is not equal to blank (meaning if it doesn't have a value) it will not insert a part. However if hcpn 
  83. has a value it will insert the part into the table.--->
  84. <cfif hcpn neq "">
  85. <cfquery name="parts" datasource="CustomerSupport">
  86.    exec usp_CS_Updateinsertparts 
  87.   <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  88.    '#Form.pk_ticketID#',
  89.     <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
  90.     <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
  91.     <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
  92.    <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
  93.  </cfquery> 
  94.  <cfelse>
  95.  </cfif>
  96. </cfloop>
  97.  
  98. <!---THIS DELETES FOR THE PARTS TABLE--->
  99. <!---setting a list for parts--->
  100. <cfset partList = ArrayToList(partcheck, ",")>
  101. <!---when inserting/updating for part's table is done it then delete parts not being updated/inserted or was to be deleted on purpose--->
  102. <cfloop query="countparts">
  103. <cfset pk_partID= #pk_partID#>
  104. <!---if the part is not found in the list it begins deleteing--->
  105. <cfif not listFind(partList,pk_partID)>
  106. <cfquery name="deleteparts" datasource="CustomerSupport">
  107. exec usp_CS_Deleteparts
  108. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  109. '#Form.pk_ticketID#'
  110. </cfquery>
  111. </cfif>
  112. </cfloop>
  113.  
  114.  
  115.  
  116. </CFLOOP>
  117.  
  118. <!---THIS DELETES FOR SERIAL TABLE AND ANY PARTS ASSOCIATED WITH THE SERIAL--->
  119. <!---setting a list for serial--->
  120. <cfset serialList = ArrayToList(serialcheck, ",")>
  121. <!---when inserting/updating for serial's table is done it then delete serials not being updated/inserted or was to be deleted on purpose--->
  122. <cfloop query="countserials">
  123. <CFSET serialnum = #pka_serialNo#>
  124. <!---if the serial is not found in the list it begins deleteing--->
  125. <cfif not listFind(serialList,serialnum)>
  126. <cfquery name="deleteserialparts" datasource="CustomerSupport">
  127. exec usp_CS_Deleteserialparts   
  128. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  129. '#Form.pk_ticketID#'
  130. </cfquery>
  131. <!---if the part is not found in the list it begins deleteing--->
  132. <cfquery name="deletedescription" datasource="CustomerSupport">
  133. exec usp_CS_Deletenotesdescription
  134. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  135. '#Form.pk_ticketID#'
  136. </cfquery>
  137. <!---</cfloop>--->
  138. </cfif>
  139. </cfloop>
  140.  
  141.  
  142.  
  143. </CFIF>
  144.  
Thank you,
Rach
Nov 21 '08 #368
acoder
16,027 Expert Mod 8TB
OK, show the code for the description on the edit page (before submission).
Nov 21 '08 #369
bonneylake
769 512MB
OK, show the code for the description on the edit page (before submission).
Hey Acoder,


In the javascript for descirption i have the following its under the serial function
Expand|Select|Wrap|Line Numbers
  1. <!--- Adds Extra fields for Description  --->
  2. newdiv.innerHTML = newdiv.innerHTML + 
  3. "<table class='zpExpandedTable' id='resoltable' cellpadding='3' cellspacing='0'>" +
  4. "<tr>" +
  5. "<td id='paddingformutli'>" +
  6. "Description:&nbsp;&nbsp;" + 
  7. "</td>" +
  8. "<td class='descriptionmoveinmulti'>" +
  9. "( You may enter up to 1000 characters. )"+
  10. "<br>" +
  11. "<textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name='thedescription_" + count + "'></textarea>" +
  12. "</td>" +
  13. "</tr>" +
  14. "</table>";
Alright at the top at the beginning i have the following it appears right under the form

Expand|Select|Wrap|Line Numbers
  1. <!---DESCRIPTION--->
  2. <input type="hidden" name="date_stamp" id="date_stamp" value="" />
  3. <input type="hidden" name="fk_addedBy" id="fk_addedBy" value="t" />
in the dynamicInput div and in between the dynamic#count#Input div i have the following.
Expand|Select|Wrap|Line Numbers
  1. <!--- Shows what was previously entered for Description ---> 
  2.  
  3.  <cfquery name="getnotes" dbtype="query" >
  4. SELECT *
  5. FROM notes
  6. WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
  7. cfsqltype="cf_sql_char" maxLength="20">
  8. </cfquery>
  9. <cfloop query="getnotes">
  10. <input type="hidden" name="pk_num_#count#" id="pk_num" value="#pk_num#" />
  11. #description#</cfloop>
  12.  
  13. <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
  14. <tr>
  15. <!---<input type="hidden" name="pk_num_#count#" id="pk_num" value="#pk_num#" />--->
  16. <td id="paddingformutli">
  17. Description:&nbsp;&nbsp;
  18. </td>
  19. <td class="descriptionmoveinmulti">
  20.  
  21. ( You may enter up to 1000 characters. )
  22. <br>
  23. <textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name="thedescription_#count#"></textarea>
  24.  
  25. </td>
  26. </tr>
  27. </table>
  28.  
an at the very end under the theValue but before the final closing div i have the following

Expand|Select|Wrap|Line Numbers
  1. <!---If have any blanks in serial table it will make field appear--->
  2. <cfoutput query="serial">
  3. <cfset model_no = #model_no#>
  4. <cfset product_type = #product_type#>
  5. <cfset type_hardware_failure = #type_hardware_failure#>
  6. <cfset pka_serialNo = #pka_serialNo#>
  7. <cfset software_hardware = #software_hardware#>
  8. <cfloop query="getnotes">
  9. <cfset description = #description#></cfloop>
  10. <cfset resolution = #resolution#>
  11. <cfset resolution_date = #resolution_date#>
  12. <cfset resolution_verified_by = #resolution_verified_by#>
  13. <cfset verification_date = #verification_date#>
  14. <cfset dept_responsibility = #dept_responsibility#>
  15. </cfoutput>
  16. <cfif serial.recordcount is 0>
  17. <cfset model_no = "">
  18. <cfset product_type = "">
  19. <cfset type_hardware_failure = "">
  20. <cfset pka_serialNo = "">
  21. <cfset software_hardware = "">
  22. <!---<cfif getnotes.recordcount is 0>
  23. <cfset description = ""></cfif>--->
  24. <cfset resolution = "">
  25. <cfset resolution_date = "">
  26. <cfset resolution_verified_by = "">
  27. <cfset verification_date = "">
  28. <cfset dept_responsibility = "">
  29. <cfinclude template="serialpartsdisplay.cfm">
  30. </cfif>
thats everything description related on the cticketpage2edit.cfm page

Thank you,
Rach
Nov 21 '08 #370
acoder
16,027 Expert Mod 8TB
See the last bit of the code:
Expand|Select|Wrap|Line Numbers
  1. <cfoutput query="serial">
  2. <cfset model_no = #model_no#>
  3. <cfset product_type = #product_type#>
  4. <cfset type_hardware_failure = #type_hardware_failure#>
  5. <cfset pka_serialNo = #pka_serialNo#>
  6. <cfset software_hardware = #software_hardware#>
  7. <cfloop query="getnotes">
  8. <cfset description = #description#></cfloop>
  9. ...
getnotes can return multiple descriptions, so the result will probably not be what you expect. This will reset description to the last one, so is most likely the cause of the problem.
Nov 21 '08 #371
bonneylake
769 512MB
See the last bit of the code:
Expand|Select|Wrap|Line Numbers
  1. <cfoutput query="serial">
  2. <cfset model_no = #model_no#>
  3. <cfset product_type = #product_type#>
  4. <cfset type_hardware_failure = #type_hardware_failure#>
  5. <cfset pka_serialNo = #pka_serialNo#>
  6. <cfset software_hardware = #software_hardware#>
  7. <cfloop query="getnotes">
  8. <cfset description = #description#></cfloop>
  9. ...
getnotes can return multiple descriptions, so the result will probably not be what you expect. This will reset description to the last one, so is most likely the cause of the problem.
Hey Acoder,

Well i took you advice an it didn't work but i think i know what the problem is. But not sure what the solution is. I have noticed today that when i go to edit a description/serial for some reason when i go back to view it (after editing) the entire serial is gone.Which could explain why a new description is not being added an why an old description is being deleted. But not sure whats causing it. Any ideas?


Expand|Select|Wrap|Line Numbers
  1. <CFIF REQUEST_METHOD EQ "POST">
  2.  
  3. <!---counts how many serials are there--->
  4.  <cfquery name="countserials" datasource="CustomerSupport">
  5. SELECT pka_serialNo from dbo.tbl_CS_serial where pkb_fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
  6.  </cfquery>
  7.  <cfset currSerialNo = 1>
  8.  
  9. <!--- the array gets serials that have been inserted and updated to avoid deleteing the ones that need to be inserted or updated--->
  10.  <cfset serialcheck = ArrayNew(1)>
  11. <!--- first loop inserts/update serials--->
  12.  <CFLOOP list="#form.serialcount#" index="machineCount">
  13. <CFSET serialnum       = Form["serialnum_" & machineCount]>
  14. <CFSET modelno         = Form["modelno_" & machineCount]>
  15. <CFSET producttype     = Form["producttype_" & machineCount]>
  16. <CFSET softhardware    = Form["softhardware_" & machineCount]>
  17. <CFSET resolution      = Form["resolution_" & machineCount]>
  18. <CFSET resdate         = Form["resdate_" & machineCount]>
  19. <CFSET resvertified    = Form["resvertified_" & machineCount]>
  20. <CFSET vertifidate     = Form["vertifidate_" & machineCount]>
  21. <CFSET deptvendor      = Form["deptvendor_" & machinecount]>
  22. <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
  23. <CFSET thedescription  = Form["thedescription_" & machineCount]>
  24. <!---the array checks to see what serials are there--->
  25. <CFSET ArrayAppend(serialcheck, "#Form["serialnum_" & machineCount]#")> 
  26.  
  27.  
  28. <!--- counts how many parts are available--->
  29.  <cfquery name="countparts" datasource="CustomerSupport">
  30. SELECT pk_partID from dbo.tbl_CS_parts where fk_serialNo=<cfqueryparam value="#serialnum#"> and fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
  31.  </cfquery>
  32. <!--- the array gets parts that have been inserted and updated to avoid deleteing the ones that need to be inserted or updated--->
  33. <cfset partcheck = ArrayNew(1)>
  34.  
  35.  
  36.  <!--- inserts information into the serial table--->
  37.  <cfquery name="serialinsertupdate" datasource="CustomerSupport">
  38.     exec usp_CS_Updateinsertserial 
  39.      <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  40.      "#Form.pk_ticketID#",
  41.      <cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
  42.       <cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
  43.      <cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
  44.      <cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
  45.      <cfqueryparam value="#resdate#">,
  46.      <cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
  47.      <cfqueryparam value="#vertifidate#">,
  48.     <cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
  49.      <cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">   
  50.      </cfquery>
  51.  
  52.  <!---Inserts information into notes_descr table.--->
  53.  
  54.  <!--- the pk_num makes each description added unique, this allows us to delete one descriptoin instead of all description associated with a serial--->
  55. <!---<CFSET pk_num = Form["pk_num_" & machinecount]>--->
  56.  
  57.   <cfquery name="description" datasource="CustomerSupport">
  58.     exec usp_CS_Insertdescription
  59.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  60.    '#Form.pk_ticketID#',
  61.     <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
  62.    '#Form.fk_addedBy#'
  63.  </cfquery>
  64.  
  65.   <!---Inserts  information into parts table.--->
  66.   <!---because it is a bit we don't use 'ticks' around defective for parts table--->
  67.  <cfparam name="form.partscount#machinecount#" default="">
  68.  <cfloop list="#form['partscount' & machinecount]#" index="ps">
  69.  <!--- the pkpartID makes each part added unique, this allows us to delete one part instead of all parts associated with a serial--->
  70.   <cfparam name="Form.pkpartID_#ps#_#machinecount#" default="">
  71.  <cfparam name="Form.hcpn_#ps#_#machinecount#" default="">
  72.  <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
  73.  <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
  74.  <cfparam name="Form.rma_#ps#_#machinecount#" default="">
  75. <!--- the pkpartID makes each part added unique, this allows us to delete one part instead of all parts associated with a serial--->
  76.  <CFSET pkpartID           = Form["pkpartID_" & "#ps#" & "_#machinecount#"]>
  77.  <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
  78.  <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
  79.  <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
  80.  <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
  81. <!---the array checks to see what parts are there--->
  82. <CFSET ArrayAppend(partcheck, "#Form["pkpartID_" & "#ps#" & "_#machinecount#"]#")>
  83. <!---if hcpn is not equal to blank (meaning if it doesn't have a value) it will not insert a part. However if hcpn 
  84. has a value it will insert the part into the table.--->
  85. <cfif hcpn neq "">
  86. <cfquery name="parts" datasource="CustomerSupport">
  87.    exec usp_CS_Updateinsertparts 
  88.   <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  89.    '#Form.pk_ticketID#',
  90.     <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
  91.     <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
  92.     <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
  93.    <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
  94.  </cfquery> 
  95.  <cfelse>
  96.  </cfif>
  97. </cfloop>
  98.  
  99. <!---THIS DELETES FOR THE PARTS TABLE--->
  100. <!---setting a list for parts--->
  101. <cfset partList = ArrayToList(partcheck, ",")>
  102. <!---when inserting/updating for part's table is done it then delete parts not being updated/inserted or was to be deleted on purpose--->
  103. <cfloop query="countparts">
  104. <cfset pk_partID= #pk_partID#>
  105. <!---if the part is not found in the list it begins deleteing--->
  106. <cfif not listFind(partList,pk_partID)>
  107. <cfquery name="deleteparts" datasource="CustomerSupport">
  108. exec usp_CS_Deleteparts
  109. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  110. '#Form.pk_ticketID#'
  111. </cfquery>
  112. </cfif>
  113. </cfloop>
  114.  
  115.  
  116.  
  117. </CFLOOP>
  118.  
  119. <!---THIS DELETES FOR SERIAL TABLE AND ANY PARTS ASSOCIATED WITH THE SERIAL--->
  120. <!---setting a list for serial--->
  121. <cfset serialList = ArrayToList(serialcheck, ",")>
  122. <!---when inserting/updating for serial's table is done it then delete serials not being updated/inserted or was to be deleted on purpose--->
  123. <cfloop query="countserials">
  124. <CFSET serialnum = #pka_serialNo#>
  125. <!---if the serial is not found in the list it begins deleteing--->
  126. <cfif not listFind(serialList,serialnum)>
  127. <cfquery name="deleteserialparts" datasource="CustomerSupport">
  128. exec usp_CS_Deleteserialparts   
  129. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  130. '#Form.pk_ticketID#'
  131. </cfquery>
  132. <!---if the part is not found in the list it begins deleteing--->
  133. <cfquery name="deletedescription" datasource="CustomerSupport">
  134. exec usp_CS_Deletenotesdescription
  135. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  136. '#Form.pk_ticketID#'
  137. </cfquery>
  138. <!---</cfloop>--->
  139. </cfif>
  140. </cfloop>
  141.  
  142.  
  143.  
  144. </CFIF>
Thank you,
Rach
Nov 21 '08 #372
acoder
16,027 Expert Mod 8TB
The delete can't be in the wrong place because if you don't delete any serials, no descriptions will be deleted.

What I would suggest you do is start with a fresh ticket and insert a new serial with a description and check that it's correct in the database. Now go to edit and see what appears in the output.
Nov 21 '08 #373
bonneylake
769 512MB
The delete can't be in the wrong place because if you don't delete any serials, no descriptions will be deleted.

What I would suggest you do is start with a fresh ticket and insert a new serial with a description and check that it's correct in the database. Now go to edit and see what appears in the output.
Hey Acoder,

Well i been checking it for the last hour everything is going in the right place. But for some reason once i hit that final submit button serials, parts and description is being deleted. An i thought it started happening today but it am not really sure now. But anyway i took everything involving the word description and commented it out an yet for some reason serial is still being deleteing! so it has nothing to do with description (Like you said) it has to do with serial.I even went back to the old code an it is still deleteing. The only thing i can think of is that a)it was a problem early but didn't notice or b) that when i tried this line maybe it did something

1. alter table dbo.tbl_CS_notes_descr
2. add constraint thefkserial FOREIGN KEY (fk_serialNo,fk_ticketNo) REFERENCES dbo.tbl_CS_serial (pka_serialNo,pkb_fk_ticketNo) on delete cascade

but not sure what i did to get serial all upset.here is what i got in full

Expand|Select|Wrap|Line Numbers
  1.  <CFIF REQUEST_METHOD EQ "POST">
  2.  
  3. <!---counts how many serials are there--->
  4.  <cfquery name="countserials" datasource="CustomerSupport">
  5. SELECT pka_serialNo from dbo.tbl_CS_serial where pkb_fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
  6.  </cfquery>
  7.  <cfset currSerialNo = 1>
  8.  
  9. <!--- the array gets serials that have been inserted and updated to avoid deleteing the ones that need to be inserted or updated--->
  10.  <cfset serialcheck = ArrayNew(1)>
  11. <!--- first loop inserts/update serials--->
  12.  <CFLOOP list="#form.serialcount#" index="machineCount">
  13. <CFSET serialnum       = Form["serialnum_" & machineCount]>
  14. <CFSET modelno         = Form["modelno_" & machineCount]>
  15. <CFSET producttype     = Form["producttype_" & machineCount]>
  16. <CFSET softhardware    = Form["softhardware_" & machineCount]>
  17. <CFSET resolution      = Form["resolution_" & machineCount]>
  18. <CFSET resdate         = Form["resdate_" & machineCount]>
  19. <CFSET resvertified    = Form["resvertified_" & machineCount]>
  20. <CFSET vertifidate     = Form["vertifidate_" & machineCount]>
  21. <CFSET deptvendor      = Form["deptvendor_" & machinecount]>
  22. <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
  23. <!---<CFSET thedescription  = Form["thedescription_" & machineCount]>--->
  24. <!---the array checks to see what serials are there--->
  25. <CFSET ArrayAppend(serialcheck, "#Form["serialnum_" & machineCount]#")> 
  26.  
  27.  
  28. <!--- counts how many parts are available--->
  29.  <cfquery name="countparts" datasource="CustomerSupport">
  30. SELECT pk_partID from dbo.tbl_CS_parts where fk_serialNo=<cfqueryparam value="#serialnum#"> and fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
  31.  </cfquery>
  32. <!--- the array gets parts that have been inserted and updated to avoid deleteing the ones that need to be inserted or updated--->
  33. <cfset partcheck = ArrayNew(1)>
  34.  
  35.  
  36.  <!--- inserts information into the serial table--->
  37.  <cfquery name="serialinsertupdate" datasource="CustomerSupport">
  38.     exec usp_CS_Updateinsertserial 
  39.      <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  40.      "#Form.pk_ticketID#",
  41.      <cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
  42.       <cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
  43.      <cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
  44.      <cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
  45.      <cfqueryparam value="#resdate#">,
  46.      <cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
  47.      <cfqueryparam value="#vertifidate#">,
  48.     <cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
  49.      <cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">   
  50.      </cfquery>
  51.  
  52.  <!---Inserts information into notes_descr table.--->
  53.  
  54.  <!--- the pk_num makes each description added unique, this allows us to delete one descriptoin instead of all description associated with a serial--->
  55. <!--- <cfquery name="description" datasource="CustomerSupport">
  56.     exec usp_CS_Insertdescription
  57.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  58.    '#Form.pk_ticketID#',
  59.    <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
  60.    '#Form.fk_addedBy#'
  61. </cfquery--->
  62.  
  63.  
  64.   <!---Inserts  information into parts table.--->
  65.   <!---because it is a bit we don't use 'ticks' around defective for parts table--->
  66.  <cfparam name="form.partscount#machinecount#" default="">
  67.  <cfloop list="#form['partscount' & machinecount]#" index="ps">
  68.  <!--- the pkpartID makes each part added unique, this allows us to delete one part instead of all parts associated with a serial--->
  69.   <cfparam name="Form.pkpartID_#ps#_#machinecount#" default="">
  70.  <cfparam name="Form.hcpn_#ps#_#machinecount#" default="">
  71.  <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
  72.  <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
  73.  <cfparam name="Form.rma_#ps#_#machinecount#" default="">
  74. <!--- the pkpartID makes each part added unique, this allows us to delete one part instead of all parts associated with a serial--->
  75.  <CFSET pkpartID           = Form["pkpartID_" & "#ps#" & "_#machinecount#"]>
  76.  <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
  77.  <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
  78.  <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
  79.  <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
  80. <!---the array checks to see what parts are there--->
  81. <CFSET ArrayAppend(partcheck, "#Form["pkpartID_" & "#ps#" & "_#machinecount#"]#")>
  82. <!---if hcpn is not equal to blank (meaning if it doesn't have a value) it will not insert a part. However if hcpn 
  83. has a value it will insert the part into the table.--->
  84. <cfif hcpn neq "">
  85. <cfquery name="parts" datasource="CustomerSupport">
  86.    exec usp_CS_Updateinsertparts 
  87.   <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  88.    '#Form.pk_ticketID#',
  89.     <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
  90.     <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
  91.     <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
  92.    <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
  93.  </cfquery> 
  94.  <cfelse>
  95.  </cfif>
  96. </cfloop>
  97.  
  98. <!---THIS DELETES FOR THE PARTS TABLE--->
  99. <!---setting a list for parts--->
  100. <cfset partList = ArrayToList(partcheck, ",")>
  101. <!---when inserting/updating for part's table is done it then delete parts not being updated/inserted or was to be deleted on purpose--->
  102. <cfloop query="countparts">
  103. <cfset pk_partID= #pk_partID#>
  104. <!---if the part is not found in the list it begins deleteing--->
  105. <cfif not listFind(partList,pk_partID)>
  106. <cfquery name="deleteparts" datasource="CustomerSupport">
  107. exec usp_CS_Deleteparts
  108. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  109. '#Form.pk_ticketID#'
  110. </cfquery>
  111. </cfif>
  112. </cfloop>
  113.  
  114.  
  115.  
  116. </CFLOOP>
  117.  
  118.  <!---THIS DELETES FOR SERIAL TABLE AND ANY PARTS ASSOCIATED WITH THE SERIAL--->
  119.  <!---setting a list for serial--->
  120.  <cfset serialList = ArrayToList(serialcheck, ",")>
  121.  <!---when inserting/updating for serial's table is done it then delete serials not being updated/inserted or was to be deleted on purpose--->
  122.  <cfloop query="countserials">
  123.  <CFSET serialnum = #pka_serialNo#>
  124.  <!---if the serial is not found in the list it begins deleteing--->
  125.  <cfif not listFind(serialList,serialnum)>
  126.  <cfquery name="deleteserialparts" datasource="CustomerSupport">
  127.  exec usp_CS_Deleteserialparts   
  128.  <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  129.  '#Form.pk_ticketID#'
  130.  </cfquery>
  131. <!---<cfquery name="deletedescription" datasource="CustomerSupport">
  132. exec usp_CS_Deletenotesdescription
  133. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  134. '#Form.pk_ticketID#'
  135.  </cfquery>--->
  136.  </cfif>
  137.  </cfloop>
  138.  
  139. </CFIF>
Thank you,
Rach
Nov 21 '08 #374
acoder
16,027 Expert Mod 8TB
Do all the serials get deleted? Check the serialnum_1, etc. fields on the previous page (edit).
Nov 21 '08 #375
bonneylake
769 512MB
Do all the serials get deleted? Check the serialnum_1, etc. fields on the previous page (edit).
Hey Acoder,

I am an idiot! I figured it out. I was messing around with stuff yesterday an i realized that i had somehow deleted the serialcount from my div (not sure how). But anyway it works like it suppose to it deletes the description when i delete the serial so i am SOOOO SORRY for the last however many posts related to this problem :(. But If you wouldnt mind just 2 more quick questions i would really really appreciate it :).

I was wondering how i could make it where if someone didn't fill out the description field it would not insert a row into the table? Right now no matter what it will still insert something for description even if i don't write a description.I was able to make it where if any of the fields for serial was not filled out it would not insert a row by using the following <cfparam name="Form.serialcount" default=""> but not sure how i could do description. here is what i am using for description

Expand|Select|Wrap|Line Numbers
  1. <cfquery name="description" datasource="CustomerSupport">
  2.     exec usp_CS_Insertdescription
  3.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  4.    '#Form.ID#',
  5.    <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
  6.    '#Form.fk_addedBy#'
  7. </cfquery>
  8.  
an the last question. Well you know how we had talked about blank fields. Where if a user does not fill out a serial or part it would still show a blank serial section an blank park section using a cfinclude template? well this part works find except the count is screwed up. When the first record comes up it says serial 1 information (like its suppose to) however when i go an add a serial it also says serial 1 information to. Instead of one saying serial 1 information an the new one i am adding saying serial 2 information. here is what i am using. I know it has to do with theValue but i am not sure if i could just remove it out of serialpartsdisplay.cfm an it would work or not?

Expand|Select|Wrap|Line Numbers
  1. <!---IF HAVE ANY BLANKS IN ANY FIELDS THIS MAKES IT SO THE FIELD WILL SHOW UP--->
  2.  
  3. <cfif serial.recordcount is 0>  
  4. <!---<cfset count = 0>--->
  5. <cfset count = count + 1>
  6. <cfoutput>
  7. <div id="dynamic#count#Input">
  8. <table class="zpExpandedTable" id="modeltable"> 
  9. <th class="sectiontitletick" colspan="7">
  10. Serial Information #count# </th>
  11. <tr>
  12. <td id="paddingformultitop">Model No:&nbsp;&nbsp;&nbsp;&nbsp;</td>
  13. </td>
  14. <td>
  15. <select name="modelno_#count#">
  16. <option value="">Make A Selection</option>
  17. <cfloop query="models">
  18. <option value="#model#">#model#</option>
  19.  
  20. </cfloop> 
  21. </select>
  22.  
  23. </td>
  24. <td>
  25. &nbsp;&nbsp;&nbsp;&nbsp;Product Type:
  26. </td>
  27. <td>
  28. <select name="producttype_#count#">
  29. <option value="" selected>No Choice</option>
  30. <cfloop query="getProdType">
  31. <option value="#pk_productType#">#pk_productType#</option> 
  32. </cfloop>
  33. </select>
  34. </td>
  35. <td class="red'">
  36. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type Of Hardware Failure*:
  37. </td>
  38. <td>
  39. <select name="hardwarefailure_#count#">
  40. <option value="" selected>Make A Selection</option>
  41. <cfloop query="getHardwareFail">
  42. <option value="#pk_hardwareFailure#">#pk_hardwareFailure#</option>
  43. </cfloop>
  44. </select>
  45. </td>
  46. </tr>
  47. <table>
  48.  
  49. <!--- Shows what was previously entered for Serial Number and Software/Hardware  --->
  50. <table class="zpExpandedTable" id="modeltable">
  51. <tr>
  52. <td id="paddingformultitop">
  53. Serial Number:&nbsp;&nbsp;
  54. <input type="text" name="serialnum_#count#" value="">
  55. &nbsp;&nbsp;&nbsp;&nbsp;Software/Hardware:&nbsp;&nbsp;
  56. <select name="softhardware_#count#">
  57. <option value="" selected>No Choice</option>
  58. <cfloop query="getSoftHard">
  59. <option value="#pk_softwareHardware#">#pk_softwareHardware#</option>
  60. </cfloop>
  61. </select>
  62. </td>
  63. </tr>
  64. </table>
  65.  
  66. <!--- Shows what was previously entered for Description ---> 
  67.  
  68. <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
  69. <tr>
  70. <td id="paddingformutli">
  71. Description:&nbsp;&nbsp;
  72. </td>
  73. <td class="descriptionmoveinmulti">
  74. ( You may enter up to 1000 characters. )
  75. <br>
  76. <textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name="thedescription_#count#"></textarea>
  77. </td>
  78. </tr>
  79. </table>
  80.  
  81. <!---Shows what was previously entered for Resolution  --->
  82.  
  83. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  84. <tr>
  85. <td id="paddingformutli">
  86. Resolution:&nbsp;&nbsp;
  87. </td>
  88. <td class="resolutionmoveinmulti">
  89. ( You may enter up to 1500 characters. )
  90. <br>
  91. <textarea maxlength='1500' onkeyup='return resolutionmaxlength(this)' onkeydown='return resolutionmaxlength(this)' rows='4' cols='60' name="resolution_#count#"></textarea>
  92. </td>
  93. </tr>
  94. </table>
  95.  
  96. <!--- Shows what was previously entered for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by  --->
  97.  
  98. <table class="zpExpandedTable" id="resoldatetab" cellpadding="1" cellspacing="0">
  99. <tr>
  100. <td id="paddingformultitop">
  101. Resolution Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
  102. </td>
  103. <td>
  104. <input type="text" name="resdate_#count#" value="">&nbsp;&nbsp;
  105.  
  106. &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
  107. <input type="checkbox" name="currentdateresol_#count#" 
  108. onClick="resdate_#count#.value=fill_date()">
  109.  
  110. </td>
  111. <td>
  112. Resolution Verified as effective by:&nbsp;&nbsp;
  113. </td>
  114. <td>
  115. <select name="resvertified_#count#">
  116. <option value="" selected>Make A Selection</option>
  117. <cfloop query="gettech">
  118. <option value="#fname# #lname#">#fname# #lname#</option>
  119. </cfloop>
  120. </select>
  121. </td>
  122. </tr>
  123. </table>
  124. <!--- Shows what was previously entered for Vertification Date, Current Date (for vertification date)   --->
  125. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  126. <tr>
  127. <td id="paddingformultitop">
  128. Verification Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
  129. </td>
  130. <td class="vertificationmoveinmulti">
  131. <input type="text" name="vertifidate_#count#" value="">&nbsp;&nbsp;
  132. &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
  133. <input type="checkbox" name="currentdatevert_#count#" 
  134. onClick="vertifidate_#count#.value=fill_date()">
  135.  
  136. </td>
  137. </tr>
  138. </table>
  139.  
  140. <!--- Shows what was previously entered for Dept/Vendor Responsibility  --->
  141. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  142. <tr>
  143. <td class="red" id="paddingformultitop">
  144. Dept/Vendor Responsibility*:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  145. <select name="deptvendor_#count#">
  146. <option value="" selected>Make A Selection</option>
  147. <cfloop query="getDeptVendor">
  148. <option value="#pk_deptVendor#">#pk_deptVendor#</option>
  149. </cfloop>
  150. </select>
  151. </td>
  152. </tr>
  153. </table>
  154.  
  155. <input type="hidden" name="serialcount" value="#count#">
  156.  <!--- Adds Delete to every ticket  --->
  157. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  158. <tr>
  159. <td>
  160. <input type="button" class="removeticket" value="Remove Serial #count#" onClick="removeElement('dynamic#count#Input')">
  161. </td>
  162. </tr>
  163. <tr>
  164. <td>
  165. <input type="button" class="addticket" value="Add Parts" onclick=
  166. "addpartInput('dynamic#count#Input')">
  167. </td>
  168. </tr>
  169. </table>
  170.  
  171. <cfset count1 = 0>
  172. <cfif parts.recordcount is 0> 
  173. <cfset count1 = count1 + 1>
  174. <div id="part#count1#Name#count#">
  175. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  176. <th class="sectiontitle" colspan="7">Parts Information #count1# Serial Information #count#</th>
  177. <tr>
  178. <td class='indent' id='formfieldpadding'>HC P/N:&nbsp;&nbsp;&nbsp;<input type='text' name="hcpn_#count1#_#count#" style="margin:0px" value=""></td>
  179. <td>
  180. Parts been returned*
  181. <input type="checkbox" name="partsreturn_#count1#_#count#" value=""<cfif #part_returned# eq "1">checked=yes</cfif>/>
  182. </td>
  183. <td>
  184. <td class="indent">Defective<input type="checkbox" name="defective_#count1#_#count#" value=""<cfif #defective# eq "1">checked=yes</cfif>/></td>
  185. </td>
  186. </tr>
  187. </table>
  188. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#">
  189.  
  190. <!--- Shows what was previously entered for RMA Data Only  --->
  191. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  192. <tr>
  193. <td id="paddingformultitop">
  194. RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;
  195. </td>
  196. <td class="rmanmoveinmulti">
  197. ( You may enter up to 1000 characters. )
  198. <br/>
  199. <textarea maxlength="1000" onKeyUp="return rmaismaxlength(this)" onKeyDown="return rmaismaxlength(this)" rows="4" cols="60" name="rma_#count1#_#count#" ></textarea>
  200. </td>
  201. </tr>
  202. </table>
  203.  
  204.  
  205. <!--- Adds Delete to every ticket  --->
  206. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  207. <tr>
  208. <td>
  209. <input type="button" class="removeticket" value="Remove Parts #count1#" 
  210. onclick="removetheElement('part#count1#Name#count#')"></a>
  211. </td>
  212. </td>
  213. </tr>
  214. </table>
  215. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#"/>
  216. </div>
  217. </cfif>
  218. <input type="hidden" name="partcounter#count#" id="partcounter#count#" value="#count1#" />
  219. </div>
  220.  
  221. </cfoutput>
  222. <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
  223.  
  224. </cfif>
Thank you so much for all the help!!! sorry again for the posts related to this problem :(
Rach
Nov 21 '08 #376
acoder
16,027 Expert Mod 8TB
@bonneylake
It's OK. It can happen, though you should keep backups of previous working versions that you can go back to.
I was wondering how i could make it where if someone didn't fill out the description field it would not insert a row into the table?
Use a cfparam for thedescription and if it's empty, don't insert.
an the last question. Well you know how we had talked about blank fields. Where if a user does not fill out a serial or part it would still show a blank serial section an blank park section using a cfinclude template? [...]I know it has to do with theValue but i am not sure if i could just remove it out of serialpartsdisplay.cfm an it would work or not?
Yeah, it looks like the theValue field is the problem. It shouldn't be in the cfinclude template file.
Nov 23 '08 #377
bonneylake
769 512MB
Hey Acoder,

Well i tried the cfparam but it still inserted a record. But it inserted it like the following.

pk_num fk_serialNo fk_ticketNo description date_stamp
111 1 60 nov/24/08

anything else i can try?

an i took out the following on my serialpartsdisplay.cfm. But it still is not counting right. Basically when it comes up it says the template is serial information 1. An when i go to add a serial it says its serial information 1. Any ideas on how i could get it to count right?

Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
Thank you :),
Rach
Nov 24 '08 #378
bonneylake
769 512MB
Hey Acoder,

I figured out both. I needed to move the following line underneath the template link an take the one in the template out.

Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
but thank you so much for all the help. You have no idea how much i appreciate all the help you have given me an how much i have learned from you!!! THANK YOU THANK YOU FOR ALL THE HELP!!!

Thank you again :)!!!!
Rach
Nov 24 '08 #379
acoder
16,027 Expert Mod 8TB
That's great! Well done and you're of course welcome any time.

The end of a very long journey ;)
Nov 24 '08 #380
bonneylake
769 512MB
Hey Acoder,

I thought the journey was over but i got one last final problem. I was running tests today to make sure everything should be good an i noticed a problem. When i went to edit i did a test of the following

serial 1
part 1
serial 2
serial 3
serial 4
part 1

when i submitted it on my printed ticket it showed it as the following

serial 1
part 1
part 1
serial 2
serial 3
serial 4
part 1

the parts for serial 1 is the same part. But then when i went to go back an edit the ticket again it didn't show any of the parts with any of the serials.it just showed the serials.i had noticed this problem the other day but i thought it was gone after doing many tests. But i guess it still there. Here is what i got
Expand|Select|Wrap|Line Numbers
  1.   <div id="dynamicInput"> 
  2.      <!--- All Ticket Information Appears Here--->
  3.  
  4.  
  5.  
  6.  
  7. <!---<cfif serial.recordcount is 0>--->
  8. <cfset count = 0>
  9. <cfoutput query="serial">
  10. <cfset count = count + 1>
  11. <cfset model_no = #model_no#>
  12. <cfset product_type = #product_type#>
  13. <cfset type_hardware_failure = #type_hardware_failure#>
  14. <cfset software_hardware = #software_hardware#>
  15. <cfset resolution_verified_by = #resolution_verified_by#>
  16. <cfset dept_responsibility = #dept_responsibility#>
  17.  
  18.  <!--- Shows what was previously entered for Model No, Product Type, and Type of Hardware Failure  --->
  19.  
  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.  
  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.  <cfquery name="getnotes" dbtype="query" >
  81. SELECT *
  82. FROM notes
  83. WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
  84. cfsqltype="cf_sql_char" maxLength="20">
  85. </cfquery>
  86. <cfloop query="getnotes">
  87.  
  88. <input type="hidden" name="pk_num_#count#" id="pk_num" value="#pk_num#" /></cfloop>
  89. <!---<div style="width: 150px; height: 150px; overflow-y: scroll; scrollbar-arrow-color:blue; 
  90. scrollbar-face-color: #e7e7e7; scrollbar-3dlight-color: #a0a0a0; scrollbar-darkshadow-color:#888888;">--->
  91. <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
  92. <tr><td id="paddingformutli">
  93. Previously Submitted Descriptions:</td><td id="paddingformutli">
  94. <div id="descriptionbox" style="HEIGHT:100px; WIDTH:500px; OVERFLOW:auto;" >
  95. <cfloop query="getnotes">
  96. Added By: #fk_addedBy# <br/>
  97. Dated Added: #DateFormat(date_stamp,'mm/dd/yyyy')#<br/><br/>
  98. #description#
  99. <div id="line"></div>
  100. </cfloop></div></td>
  101.  
  102. </tr>
  103. </table>
  104. <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
  105. <tr>
  106. <!---<input type="hidden" name="thedescriptoin_#count#" id="thedescriptoin" value="#description#" />--->
  107. <td id="paddingformutli">
  108. Description:&nbsp;&nbsp;
  109. </td>
  110. <td class="descriptionmoveinmulti">
  111.  
  112. ( You may enter up to 1000 characters. )
  113. <br>
  114. <textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name="thedescription_#count#"></textarea>
  115.  
  116. </td>
  117. </tr>
  118. </table>
  119. <!---Shows what was previously entered for Resolution ---> 
  120.  
  121. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  122. <tr>
  123. <td id="paddingformutli">
  124. Resolution:&nbsp;&nbsp;
  125. </td>
  126. <td class="resolutionmoveinmulti">
  127. ( You may enter up to 1500 characters. )
  128. <br>
  129. <textarea  maxlength="1500" onkeyup="return resolutionismaxlength(this)" onkeydown="return resolutionismaxlength(this)" rows="4" cols="60" name="resolution_#count#">#resolution#</textarea>
  130. </td>
  131. </tr>
  132. </table>
  133.  
  134. <!--- Shows what was previously entered for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by  --->
  135.  
  136. <table class="zpExpandedTable" id="resoldatetab" cellpadding="1" cellspacing="0">
  137. <tr>
  138. <td id="paddingformultitop">
  139. Resolution Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
  140. </td>
  141. <td>
  142. <input type="text" name="resdate_#count#" value="#DateFormat(resolution_date,'mm/dd/yyyy')#">&nbsp;&nbsp;
  143. &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
  144. <input type="checkbox" name="currentdateresol_#count#" 
  145. onClick="resdate_#count#.value=fill_date()">
  146. </td>
  147. <td>
  148. Resolution Verified as effective by:&nbsp;&nbsp;
  149. </td>
  150. <td>
  151. <select name="resvertified_#count#">
  152. <option value="" selected>Make A Selection</option>
  153. <cfloop query="gettech">
  154. <option value="#fname# #lname#"<cfif "#fname# #lname#" is #resolution_verified_by#>
  155. selected</cfif>>#fname# #lname#</option>
  156. </cfloop>
  157. </select>
  158. </td>
  159. </tr>
  160. </table>
  161. <!--- Shows what was previously entered for Vertification Date, Current Date (for vertification date)   --->
  162. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  163. <tr>
  164. <td id="paddingformultitop">
  165. Verification Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
  166. </td>
  167. <td class="vertificationmoveinmulti">
  168. <input type="text" name="vertifidate_#count#" value="#DateFormat(verification_date,'mm/dd/yyyy')#">&nbsp;&nbsp;
  169. &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
  170. <input type="checkbox" name="currentdatevert_#count#" 
  171. onClick="vertifidate_#count#.value=fill_date()">
  172. </td>
  173. </tr>
  174. </table>
  175.  
  176. <!--- Shows what was previously entered for Dept/Vendor Responsibility  --->
  177. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  178. <tr>
  179. <td class="red" id="paddingformultitop">
  180. Dept/Vendor Responsibility*:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  181. <select name="deptvendor_#count#">
  182. <option value="" selected>Make A Selection</option>
  183. <cfloop query="getDeptVendor">
  184. <option value="#pk_deptVendor#"<cfif #pk_deptVendor# is #dept_responsibility#>selected</cfif>>#pk_deptVendor#</option>
  185. </cfloop>
  186. </select>
  187. </td>
  188. </tr>
  189. </table>
  190. <input type="hidden" name="serialcount" id="serialcount" value="#count#">
  191.  
  192.  
  193.  
  194. <!--- Adds Delete to every ticket  --->
  195. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  196. <tr>
  197. <td>
  198. <input type="button" class="removeticket" value="Remove Serial #count#" onclick="removeElement('dynamic#count#Input')">
  199. </td>
  200. </tr>
  201. <tr>
  202. <td>
  203. <input type="button" class="addticket" value="Add Parts" onclick="addpartInput('dynamic#count#Input')">
  204. </td>
  205. </tr>
  206. </table>
  207.  
  208.  
  209. <!---Shows what was previously entered into parts table--->
  210. <!---dbtype="query"--->
  211. <cfquery name="getparts" dbtype="query" >
  212. SELECT *
  213. FROM parts
  214. WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
  215. cfsqltype="cf_sql_char" maxLength="20">
  216. </cfquery>
  217. <cfset count1 = 0>
  218. <!---<cfif serial.recordcount is 0>--->
  219. <cfloop query="getparts">
  220. <cfset count1 = count1 + 1>
  221. <div id="part#count1#Name#count#">
  222. <!---<cfset partliststr = "">
  223. <cfloop from="1" to="#count1#" index="pl">
  224. <cfset partliststr = partliststr & #pl# & ",">
  225. </cfloop>
  226.  
  227. <input type="hidden" name="part2count#count#" id="part2count#count#" value="#partliststr#">
  228. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#">--->
  229.  
  230. <!---THIS IS THE PARTS SECTION--->
  231.  
  232. <input type="hidden" name="pkpartID_#count1#_#count#" id="pkpartID" value="#pk_partID#" />
  233.  
  234. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  235. <th class="sectiontitle" colspan="7">Parts Information #count1# Serial Information #count#</th>
  236. <tr>
  237. <td class='indent' id='formfieldpadding'>HC P/N:&nbsp;&nbsp;&nbsp;<input type='text' name="hcpn_#count1#_#count#" style="margin:0px" value="#hc_partNo#"></td>
  238. <td>
  239. Parts been returned*
  240. <input type="checkbox" name="partsreturn_#count1#_#count#" value="#part_returned#"<cfif #part_returned# eq "1">checked=yes</cfif>/>
  241. </td>
  242. <td>
  243. <td class="indent">Defective<input type="checkbox" name="defective_#count1#_#count#" value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/></td>
  244. </td>
  245. </tr>
  246. </table>
  247. <!---<input type="hidden" name="partscount#count#" id="partscount#count#" value="#count#">--->
  248.  
  249.  
  250. <!--- Shows what was previously entered for RMA Data Only  --->
  251. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  252. <tr>
  253. <td id="paddingformultitop">
  254. RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;
  255. </td>
  256. <td class="rmanmoveinmulti">
  257. ( You may enter up to 1000 characters. )
  258. <br/>
  259. <textarea maxlength="1000" onkeyup="return rmaismaxlength(this)" onkeydown="return rmaismaxlength(this)" rows="4" cols="60" name="rma_#count1#_#count#" >#rma_number#</textarea>
  260. </td>
  261. </tr>
  262. </table>
  263.  
  264.  
  265. <!--- Adds Delete to every ticket  --->
  266. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  267. <tr>
  268. <td>
  269. <input type="button" class="removeticket" value="Remove Parts #count1#" 
  270. onclick="removetheElement('part#count1#Name#count#',#count#,#count#)"></a>
  271. </td>
  272. </td>
  273. </tr>
  274. </table>
  275. </div>
  276. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#"/>
  277. </cfloop>
  278. </div>
  279. <!---this one makes it so you can add a part to a previously submitted serial--->
  280. <input type="hidden" name="partcounter#count#" id="partcounter#count#" value="#count1#" />
  281. </cfoutput>
  282.  
  283.  
  284.  
  285.  
  286.  
  287. <!---If have any blanks in serial table it will make field appear--->
  288. <cfoutput query="serial">
  289. <cfset model_no = #model_no#>
  290. <cfset product_type = #product_type#>
  291. <cfset type_hardware_failure = #type_hardware_failure#>
  292. <cfset pka_serialNo = #pka_serialNo#>
  293. <cfset software_hardware = #software_hardware#>
  294. <cfloop query="getnotes">
  295. <cfset description = #description#></cfloop>
  296. <cfset resolution = #resolution#>
  297. <cfset resolution_date = #resolution_date#>
  298. <cfset resolution_verified_by = #resolution_verified_by#>
  299. <cfset verification_date = #verification_date#>
  300. <cfset dept_responsibility = #dept_responsibility#>
  301. </cfoutput>
  302. <cfif serial.recordcount is 0>
  303. <cfset model_no = "">
  304. <cfset product_type = "">
  305. <cfset type_hardware_failure = "">
  306. <cfset pka_serialNo = "">
  307. <cfset software_hardware = "">
  308. <!---<cfif getnotes.recordcount is 0>
  309. <cfset description = ""></cfif>--->
  310. <cfset resolution = "">
  311. <cfset resolution_date = "">
  312. <cfset resolution_verified_by = "">
  313. <cfset verification_date = "">
  314. <cfset dept_responsibility = "">
  315. <cfinclude template="serialpartsdisplay.cfm">
  316. </cfif>
  317.  
  318. <!---Parts Information, display parts if have or don't have a value--->
  319. <cfoutput query="parts">
  320. <cfset hc_partNo = #hc_partNo#>
  321. <cfset part_returned = #part_returned#>
  322. <cfset defective = #defective#>
  323. <cfset rma_number = #rma_number#>
  324. <!---<cfinclude template="partsdisplay.cfm">--->
  325. </cfoutput>
  326. <cfif parts.recordcount is 0>
  327. <cfset hc_partNo = "">
  328. <cfset part_returned = "">
  329. <cfset defective = "">
  330. <cfset rma_number = "">
  331. <!---<cfinclude template="partsdisplay.cfm">--->
  332. </cfif>
  333.  
  334. <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
  335. </div>
  336.  
  337.      <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
i also tried to just to insert a new serial as the example i gave above an i came back to look at the edit page an it came back as

serial 2
serial 3
serial 4
part 1
serial 1
part 1

the parts are with the correct serial just the serials are not in the correct order that it was submitted.

Thank you,
Rach
Nov 25 '08 #381
acoder
16,027 Expert Mod 8TB
Can you remember the changes that you've made to this page since it worked, i.e. when this problem didn't occur?

There seems to be two problems here. One is that it's displaying duplicate parts and the second problem is that all parts are disappearing.

In the example, did you delete any parts? What were the exact steps that you took to produce that scenario?
Nov 25 '08 #382
bonneylake
769 512MB
Hey Acoder,

Well to be honest with you i have been having this problem, just at the time i was having the problem we was stiill working on it so i figure i wait to ask. But then of course i forgot about it an now when i am testing it came back up an i went oh yeah. But anyway ok for the 2 tests.

The first test. The first one i had originally submitted one serial and one part. When i went to edit i deleted them both an submitted (was testing everything this morning to make sure no problems with updating/deleteing an inserting). Anyway i went back to the edit again i an i did the following

serial 1
part 1
serial 2
serial 3
serial 4
part 1

and i submitted an that was when i saw the duplicate part for serial 1 on my printticketedit.cfm page. I then went back to edit again an i noticed that none of the parts where there.

the second test i did all i did was insert the following (didn't delete).

serial 1
part 1
serial 2
serial 3
serial 4
part 1

On my printticket.cfm page it looked great. When i went to the edit page it came back as

serial 2
serial 3
serial 4
part 1
serial 1
part 1

the serials where with the correct part just the serials where not in the correct order.

i think i figured it out. Its displaying the serials based on the name. I did a 3rd test just now. For the serials i had the following names
s2
s3
s4
part 4
serial 1
p1

when i changed the name from serial 1 to s1 it put it in the correct order which is

s1
p1
s2
s3
s4
part 4

is there anyway to make the results come back as they were inserted an not based on alphabetical order?

Thank you,
Rach
Nov 25 '08 #383
acoder
16,027 Expert Mod 8TB
The second scenario looks easier (inserts only). Try adding an ORDER BY clause to your queries to avoid problems with retrieving data. The obvious field to order by would be the unique ID.

Edit: I see you edited your post. To answer that, by serial and parts IDs.
Nov 25 '08 #384
bonneylake
769 512MB
Hey Acoder,

well i think its just going to remain as it is because it doesn't really have a unique field. I tried ordering by pka_serialNo and also tried pkb_fk_ticketNo and it still ordered in alphabetical order (from the looks of it, it inserts in alphabetical order)

but on the parts problem i think i know what the problem is. I was able to duplicate the problem. Remember how if no serial/part is inserted the template comes up? well the template is somehow causing the duplicate. Because when i added 1 part to that first serial it made it duplicate. But i am not sure how to discontinue this problem. An its the only time this problem appears.Here is what on got on the template.

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

I see with the template that you combined them into one. The purpose of the template was to remove the code from the main file, so that changes are only made in one place.
Nov 25 '08 #386
bonneylake
769 512MB
Hey Acoder,

I don't even have a date. Because the date i use for serial table is one that the user inserts an they might or might not insert that.An like i said when the fields insert into the table its inserting alphabetically. So i think i am stuck with it showing it as it is. I am just afraid they will get confused is all when they go back to look.The only way i can think of if there is a way that when they go to insert it will insert based on how it appears an not just go an put it in order because it puts it in order in the table based on the serial no. In my parts table when i inserted records as the following
test 1
part 6
test2
part 5

in the database it showed it was as below an the serial, ticket and pk_partID fields are not in any pacific order.
part 6
part 5

if there was a way to do the same thing we do to parts to serial that would work but i don't know why its not in any pacific order.

An i am confused on what you mean by the template. I thought the point of the template was that if a user did not insert a value into a field in the serial section or part section that this would still show those fields but empty?because remember a while back i had the trouble where if a user did not fill out a field it would not show the input field field for it at all an all i would have is for example serial number but no where to type the serial number. I am not having trouble with no input field showing up anymore. However, how its being used now (or how i have been using it) is if i a user did not fill in a serial or part when they inserted, if they go back to edit all they will see is add serial button an this makes it so that if nothing was inserted it would show a blank serial and part to fill out instead of a blank section where the serial and part should be.

The reason i combined them is because i was having lots of trouble with the parts ordering right.Basically for that template serial if i clicked add part it didn't order the part right at all. I tried to keep them seperate but it just kept messing up an finally putting them together made it work right. But like i said when i add one part to it, for some reason its showing duplicates on my print page. Any ideas on how to fix the duplicate?

Thank you,
Rach
Nov 25 '08 #387
acoder
16,027 Expert Mod 8TB
We'll leave the serial ordering for now and work on the template.

I understand what you're saying about the template, but when the template was created it gave the ability to use one code for both no serials and some serials (with the record count check). You should only have one version otherwise you may as well not have a template and just put the code directly in the file.

What I suggest you do is make a copy of the template file (to go back to if needed), and then copy the code from the main file (between the serial divs) into this template file to test. Once you have it working, you can replace all that code with this template file.
Nov 25 '08 #388
bonneylake
769 512MB
Hey Acoder,

Well i copied what was on cticketpage2edit.cfm (main page) what was between the serials an this is what i have. an i did a test where i inserted a serial with a few fields filled in an some not an when i went back to look it looked great. But how would i make the whole template come up if nothing was filled in? when i tried inserting no serial, nothing came up except the add serial button.here is what i have


Expand|Select|Wrap|Line Numbers
  1. <!---<cfif serial.recordcount is 0>--->
  2. <cfset count = 0>
  3. <cfoutput query="serial">
  4. <cfset count = count + 1>
  5. <cfset model_no = #model_no#>
  6. <cfset product_type = #product_type#>
  7. <cfset type_hardware_failure = #type_hardware_failure#>
  8. <cfset software_hardware = #software_hardware#>
  9. <cfset resolution_verified_by = #resolution_verified_by#>
  10. <cfset dept_responsibility = #dept_responsibility#>
  11.  
  12.  <!--- Shows what was previously entered for Model No, Product Type, and Type of Hardware Failure  --->
  13.  
  14. <div id="dynamic#count#Input"> 
  15. <table class="zpExpandedTable" id="modeltable"> 
  16. <th class="sectiontitletick" colspan="7">
  17. Serial Information #count# </th>
  18. <tr>
  19. <td id="paddingformultitop">Model No:&nbsp;&nbsp;&nbsp;&nbsp;</td>
  20. </td>
  21. <td>
  22. <select name="modelno_#count#">
  23. <option value="">Make A Selection</option>
  24. <cfloop query="models">
  25. <option value="#model#">#model#</option>
  26. </cfloop> 
  27. </select>
  28. </td>
  29. <td>
  30. &nbsp;&nbsp;&nbsp;&nbsp;Product Type:
  31. </td>
  32. <td>
  33. <select name="producttype_#count#">
  34. <option value="" selected>No Choice</option>
  35. <cfloop query="getProdType">
  36. <option value="#pk_productType#">#pk_productType#</option> 
  37. </cfloop>
  38. </select>
  39. </td>
  40. <td class="red">
  41. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type Of Hardware Failure*:
  42. </td>
  43. <td>
  44.  
  45. <select name="hardwarefailure_#count#">
  46. <option value="" selected>Make A Selection</option>
  47. <cfloop query="getHardwareFail">
  48. <option value="#pk_hardwareFailure#">#pk_hardwareFailure#</option>
  49. </cfloop>
  50. </select>
  51. </td>
  52. </tr>
  53. <table>
  54.  
  55. <!--- Shows what was previously entered for Serial Number and Software/Hardware  --->
  56. <table class="zpExpandedTable" id="modeltable">
  57. <tr>
  58. <td id="paddingformultitop">
  59. Serial Number:&nbsp;&nbsp;
  60. <input type="text" name="serialnum_#count#" value="">
  61. &nbsp;&nbsp;&nbsp;&nbsp;Software/Hardware:&nbsp;&nbsp;
  62. <select name="softhardware_#count#">
  63. <option value="" selected>No Choice</option>
  64. <cfloop query="getSoftHard">
  65. <option value="#pk_softwareHardware#">#pk_softwareHardware#</option>
  66. </cfloop>
  67. </select>
  68. </td>
  69. </tr>
  70. </table>
  71.  
  72. <!--- Shows what was previously entered for Description ---> 
  73.  
  74.  <cfquery name="getnotes" dbtype="query" >
  75. SELECT *
  76. FROM notes
  77. WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
  78. cfsqltype="cf_sql_char" maxLength="20">
  79. </cfquery>
  80. <cfloop query="getnotes">
  81.  
  82. <input type="hidden" name="pk_num_#count#" id="pk_num" value="" /></cfloop>
  83. <!---<div style="width: 150px; height: 150px; overflow-y: scroll; scrollbar-arrow-color:blue; 
  84. scrollbar-face-color: #e7e7e7; scrollbar-3dlight-color: #a0a0a0; scrollbar-darkshadow-color:#888888;">--->
  85. <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
  86. <tr><td id="paddingformutli">
  87. Previously Submitted Descriptions:</td><td id="paddingformutli">
  88. <div id="descriptionbox" style="HEIGHT:100px; WIDTH:500px; OVERFLOW:auto;" >
  89. <cfloop query="getnotes">
  90. Added By:  <br/>
  91. Dated Added: <br/><br/>
  92. <div id="line"></div>
  93. </cfloop></div></td>
  94.  
  95. </tr>
  96. </table>
  97. <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
  98. <tr>
  99. <!---<input type="hidden" name="thedescriptoin_#count#" id="thedescriptoin" value="#description#" />--->
  100. <td id="paddingformutli">
  101. Description:&nbsp;&nbsp;
  102. </td>
  103. <td class="descriptionmoveinmulti">
  104.  
  105. ( You may enter up to 1000 characters. )
  106. <br>
  107. <textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name="thedescription_#count#"></textarea>
  108.  
  109. </td>
  110. </tr>
  111. </table>
  112. <!---Shows what was previously entered for Resolution ---> 
  113.  
  114. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  115. <tr>
  116. <td id="paddingformutli">
  117. Resolution:&nbsp;&nbsp;
  118. </td>
  119. <td class="resolutionmoveinmulti">
  120. ( You may enter up to 1500 characters. )
  121. <br>
  122. <textarea  maxlength="1500" onKeyUp="return resolutionismaxlength(this)" onKeyDown="return resolutionismaxlength(this)" rows="4" cols="60" name="resolution_#count#"></textarea>
  123. </td>
  124. </tr>
  125. </table>
  126.  
  127. <!--- Shows what was previously entered for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by  --->
  128.  
  129. <table class="zpExpandedTable" id="resoldatetab" cellpadding="1" cellspacing="0">
  130. <tr>
  131. <td id="paddingformultitop">
  132. Resolution Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
  133. </td>
  134. <td>
  135. <input type="text" name="resdate_#count#" value="">&nbsp;&nbsp;
  136. &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
  137. <input type="checkbox" name="currentdateresol_#count#" 
  138. onClick="resdate_#count#.value=fill_date()">
  139. </td>
  140. <td>
  141. Resolution Verified as effective by:&nbsp;&nbsp;
  142. </td>
  143. <td>
  144. <select name="resvertified_#count#">
  145. <option value="" selected>Make A Selection</option>
  146. <cfloop query="gettech">
  147. <option value="#fname# #lname#">#fname# #lname#</option>
  148. </cfloop>
  149. </select>
  150. </td>
  151. </tr>
  152. </table>
  153. <!--- Shows what was previously entered for Vertification Date, Current Date (for vertification date)   --->
  154. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  155. <tr>
  156. <td id="paddingformultitop">
  157. Verification Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
  158. </td>
  159. <td class="vertificationmoveinmulti">
  160. <input type="text" name="vertifidate_#count#" value="">&nbsp;&nbsp;
  161. &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
  162. <input type="checkbox" name="currentdatevert_#count#" 
  163. onClick="vertifidate_#count#.value=fill_date()">
  164. </td>
  165. </tr>
  166. </table>
  167.  
  168. <!--- Shows what was previously entered for Dept/Vendor Responsibility  --->
  169. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  170. <tr>
  171. <td class="red" id="paddingformultitop">
  172. Dept/Vendor Responsibility*:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  173. <select name="deptvendor_#count#">
  174. <option value="" selected>Make A Selection</option>
  175. <cfloop query="getDeptVendor">
  176. <option value="#pk_deptVendor#">#pk_deptVendor#</option>
  177. </cfloop>
  178. </select>
  179. </td>
  180. </tr>
  181. </table>
  182. <input type="hidden" name="serialcount" id="serialcount" value="#count#">
  183.  
  184.  
  185.  
  186. <!--- Adds Delete to every ticket  --->
  187. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  188. <tr>
  189. <td>
  190. <input type="button" class="removeticket" value="Remove Serial #count#" onClick="removeElement('dynamic#count#Input')">
  191. </td>
  192. </tr>
  193. <tr>
  194. <td>
  195. <input type="button" class="addticket" value="Add Parts" onClick="addpartInput('dynamic#count#Input')">
  196. </td>
  197. </tr>
  198. </table>
  199.  
  200.  
  201. <!---Shows what was previously entered into parts table--->
  202. <!---dbtype="query"--->
  203. <cfquery name="getparts" dbtype="query" >
  204. SELECT *
  205. FROM parts
  206. WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
  207. cfsqltype="cf_sql_char" maxLength="20">
  208. </cfquery>
  209. <cfset count1 = 0>
  210. <!---<cfif serial.recordcount is 0>--->
  211. <cfloop query="getparts">
  212. <cfset count1 = count1 + 1>
  213. <div id="part#count1#Name#count#">
  214. <!---<cfset partliststr = "">
  215. <cfloop from="1" to="#count1#" index="pl">
  216. <cfset partliststr = partliststr & #pl# & ",">
  217. </cfloop>
  218.  
  219. <input type="hidden" name="part2count#count#" id="part2count#count#" value="#partliststr#">
  220. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#">--->
  221.  
  222. <!---THIS IS THE PARTS SECTION--->
  223.  
  224. <input type="hidden" name="pkpartID_#count1#_#count#" id="pkpartID" value="" />
  225.  
  226. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  227. <th class="sectiontitle" colspan="7">Parts Information #count1# Serial Information #count#</th>
  228. <tr>
  229. <td class='indent' id='formfieldpadding'>HC P/N:&nbsp;&nbsp;&nbsp;<input type='text' name="hcpn_#count1#_#count#" style="margin:0px" value=""></td>
  230. <td>
  231. Parts been returned*
  232. <input type="checkbox" name="partsreturn_#count1#_#count#" value=""/>
  233. </td>
  234. <td>
  235. <td class="indent">Defective<input type="checkbox" name="defective_#count1#_#count#"/></td>
  236. </td>
  237. </tr>
  238. </table>
  239. <!---<input type="hidden" name="partscount#count#" id="partscount#count#" value="#count#">--->
  240.  
  241.  
  242. <!--- Shows what was previously entered for RMA Data Only  --->
  243. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  244. <tr>
  245. <td id="paddingformultitop">
  246. RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;
  247. </td>
  248. <td class="rmanmoveinmulti">
  249. ( You may enter up to 1000 characters. )
  250. <br/>
  251. <textarea maxlength="1000" onKeyUp="return rmaismaxlength(this)" onKeyDown="return rmaismaxlength(this)" rows="4" cols="60" name="rma_#count1#_#count#" ></textarea>
  252. </td>
  253. </tr>
  254. </table>
  255.  
  256.  
  257. <!--- Adds Delete to every ticket  --->
  258. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  259. <tr>
  260. <td>
  261. <input type="button" class="removeticket" value="Remove Parts #count1#" 
  262. onclick="removetheElement('part#count1#Name#count#',#count#,#count#)"></a>
  263. </td>
  264. </td>
  265. </tr>
  266. </table>
  267. </div>
  268. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#"/>
  269. </cfloop>
  270. </div>
  271. <!---this one makes it so you can add a part to a previously submitted serial--->
  272. <input type="hidden" name="partcounter#count#" id="partcounter#count#" value="#count1#" />
  273. </cfoutput>
heres that part on the cticketpage2edit.cfm

Expand|Select|Wrap|Line Numbers
  1. <!---If have any blanks in serial table it will make field appear--->
  2. <cfoutput query="serial">
  3. <cfset model_no = #model_no#>
  4. <cfset product_type = #product_type#>
  5. <cfset type_hardware_failure = #type_hardware_failure#>
  6. <cfset pka_serialNo = #pka_serialNo#>
  7. <cfset software_hardware = #software_hardware#>
  8. <cfloop query="getnotes">
  9. <cfset description = #description#></cfloop>
  10. <cfset resolution = #resolution#>
  11. <cfset resolution_date = #resolution_date#>
  12. <cfset resolution_verified_by = #resolution_verified_by#>
  13. <cfset verification_date = #verification_date#>
  14. <cfset dept_responsibility = #dept_responsibility#>
  15. </cfoutput>
  16. <cfif serial.recordcount is 0>
  17. <cfset model_no = "">
  18. <cfset product_type = "">
  19. <cfset type_hardware_failure = "">
  20. <cfset pka_serialNo = "">
  21. <cfset software_hardware = "">
  22. <!---<cfif getnotes.recordcount is 0>
  23. <cfset description = ""></cfif>--->
  24. <cfset resolution = "">
  25. <cfset resolution_date = "">
  26. <cfset resolution_verified_by = "">
  27. <cfset verification_date = "">
  28. <cfset dept_responsibility = "">
  29. <cfinclude template="serialpartsdisplaytest.cfm">
  30. </cfif>
  31.  
  32. <!---Parts Information, display parts if have or don't have a value--->
  33. <cfoutput query="parts">
  34. <cfset hc_partNo = #hc_partNo#>
  35. <cfset part_returned = #part_returned#>
  36. <cfset defective = #defective#>
  37. <cfset rma_number = #rma_number#>
  38. <!---<cfinclude template="partsdisplay.cfm">--->
  39. </cfoutput>
  40. <cfif parts.recordcount is 0>
  41. <cfset hc_partNo = "">
  42. <cfset part_returned = "">
  43. <cfset defective = "">
  44. <cfset rma_number = "">
  45. <!---<cfinclude template="partsdisplay.cfm">--->
  46. </cfif>
Thank you,
Rach
Nov 25 '08 #389
acoder
16,027 Expert Mod 8TB
It should be from the div on line 14 onwards, not all of the code.
Nov 25 '08 #390
bonneylake
769 512MB
Hey Acoder,

I tried the line 14 onwards an well i had to take out the last cfoutput. An well when i looked at the test ticket with the serial that i filled in just a few fields it worked correctly. However, when i looked at the serial where no serial had been inserted it now makes the serial say serial #count# information

Expand|Select|Wrap|Line Numbers
  1. <!--- Shows what was previously entered for Model No, Product Type, and Type of Hardware Failure  --->
  2. <div id="dynamic#count#Input"> 
  3. <table class="zpExpandedTable" id="modeltable"> 
  4. <th class="sectiontitletick" colspan="7">
  5. Serial Information #count# </th>
  6. <tr>
  7. <td id="paddingformultitop">Model No:&nbsp;&nbsp;&nbsp;&nbsp;</td>
  8. </td>
  9. <td>
  10. <select name="modelno_#count#">
  11. <option value="">Make A Selection</option>
  12. <cfloop query="models">
  13. <option value="#model#">#model#</option>
  14. </cfloop> 
  15. </select>
  16. </td>
  17. <td>
  18. &nbsp;&nbsp;&nbsp;&nbsp;Product Type:
  19. </td>
  20. <td>
  21. <select name="producttype_#count#">
  22. <option value="" selected>No Choice</option>
  23. <cfloop query="getProdType">
  24. <option value="#pk_productType#">#pk_productType#</option> 
  25. </cfloop>
  26. </select>
  27. </td>
  28. <td class="red">
  29. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type Of Hardware Failure*:
  30. </td>
  31. <td>
  32.  
  33. <select name="hardwarefailure_#count#">
  34. <option value="" selected>Make A Selection</option>
  35. <cfloop query="getHardwareFail">
  36. <option value="#pk_hardwareFailure#">#pk_hardwareFailure#</option>
  37. </cfloop>
  38. </select>
  39. </td>
  40. </tr>
  41. <table>
  42.  
  43. <!--- Shows what was previously entered for Serial Number and Software/Hardware  --->
  44. <table class="zpExpandedTable" id="modeltable">
  45. <tr>
  46. <td id="paddingformultitop">
  47. Serial Number:&nbsp;&nbsp;
  48. <input type="text" name="serialnum_#count#" value="">
  49. &nbsp;&nbsp;&nbsp;&nbsp;Software/Hardware:&nbsp;&nbsp;
  50. <select name="softhardware_#count#">
  51. <option value="" selected>No Choice</option>
  52. <cfloop query="getSoftHard">
  53. <option value="#pk_softwareHardware#">#pk_softwareHardware#</option>
  54. </cfloop>
  55. </select>
  56. </td>
  57. </tr>
  58. </table>
  59.  
  60. <!--- Shows what was previously entered for Description ---> 
  61.  
  62.  <cfquery name="getnotes" dbtype="query" >
  63. SELECT *
  64. FROM notes
  65. WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
  66. cfsqltype="cf_sql_char" maxLength="20">
  67. </cfquery>
  68. <cfloop query="getnotes">
  69.  
  70. <input type="hidden" name="pk_num_#count#" id="pk_num" value="" /></cfloop>
  71. <!---<div style="width: 150px; height: 150px; overflow-y: scroll; scrollbar-arrow-color:blue; 
  72. scrollbar-face-color: #e7e7e7; scrollbar-3dlight-color: #a0a0a0; scrollbar-darkshadow-color:#888888;">--->
  73. <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
  74. <tr><td id="paddingformutli">
  75. Previously Submitted Descriptions:</td><td id="paddingformutli">
  76. <div id="descriptionbox" style="HEIGHT:100px; WIDTH:500px; OVERFLOW:auto;" >
  77. <cfloop query="getnotes">
  78. Added By:  <br/>
  79. Dated Added: <br/><br/>
  80. <div id="line"></div>
  81. </cfloop></div></td>
  82.  
  83. </tr>
  84. </table>
  85. <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
  86. <tr>
  87. <!---<input type="hidden" name="thedescriptoin_#count#" id="thedescriptoin" value="#description#" />--->
  88. <td id="paddingformutli">
  89. Description:&nbsp;&nbsp;
  90. </td>
  91. <td class="descriptionmoveinmulti">
  92.  
  93. ( You may enter up to 1000 characters. )
  94. <br>
  95. <textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name="thedescription_#count#"></textarea>
  96.  
  97. </td>
  98. </tr>
  99. </table>
  100. <!---Shows what was previously entered for Resolution ---> 
  101.  
  102. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  103. <tr>
  104. <td id="paddingformutli">
  105. Resolution:&nbsp;&nbsp;
  106. </td>
  107. <td class="resolutionmoveinmulti">
  108. ( You may enter up to 1500 characters. )
  109. <br>
  110. <textarea  maxlength="1500" onKeyUp="return resolutionismaxlength(this)" onKeyDown="return resolutionismaxlength(this)" rows="4" cols="60" name="resolution_#count#"></textarea>
  111. </td>
  112. </tr>
  113. </table>
  114.  
  115. <!--- Shows what was previously entered for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by  --->
  116.  
  117. <table class="zpExpandedTable" id="resoldatetab" cellpadding="1" cellspacing="0">
  118. <tr>
  119. <td id="paddingformultitop">
  120. Resolution Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
  121. </td>
  122. <td>
  123. <input type="text" name="resdate_#count#" value="">&nbsp;&nbsp;
  124. &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
  125. <input type="checkbox" name="currentdateresol_#count#" 
  126. onClick="resdate_#count#.value=fill_date()">
  127. </td>
  128. <td>
  129. Resolution Verified as effective by:&nbsp;&nbsp;
  130. </td>
  131. <td>
  132. <select name="resvertified_#count#">
  133. <option value="" selected>Make A Selection</option>
  134. <cfloop query="gettech">
  135. <option value="#fname# #lname#">#fname# #lname#</option>
  136. </cfloop>
  137. </select>
  138. </td>
  139. </tr>
  140. </table>
  141. <!--- Shows what was previously entered for Vertification Date, Current Date (for vertification date)   --->
  142. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  143. <tr>
  144. <td id="paddingformultitop">
  145. Verification Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
  146. </td>
  147. <td class="vertificationmoveinmulti">
  148. <input type="text" name="vertifidate_#count#" value="">&nbsp;&nbsp;
  149. &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
  150. <input type="checkbox" name="currentdatevert_#count#" 
  151. onClick="vertifidate_#count#.value=fill_date()">
  152. </td>
  153. </tr>
  154. </table>
  155.  
  156. <!--- Shows what was previously entered for Dept/Vendor Responsibility  --->
  157. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  158. <tr>
  159. <td class="red" id="paddingformultitop">
  160. Dept/Vendor Responsibility*:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  161. <select name="deptvendor_#count#">
  162. <option value="" selected>Make A Selection</option>
  163. <cfloop query="getDeptVendor">
  164. <option value="#pk_deptVendor#">#pk_deptVendor#</option>
  165. </cfloop>
  166. </select>
  167. </td>
  168. </tr>
  169. </table>
  170. <input type="hidden" name="serialcount" id="serialcount" value="#count#">
  171.  
  172.  
  173.  
  174. <!--- Adds Delete to every ticket  --->
  175. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  176. <tr>
  177. <td>
  178. <input type="button" class="removeticket" value="Remove Serial #count#" onClick="removeElement('dynamic#count#Input')">
  179. </td>
  180. </tr>
  181. <tr>
  182. <td>
  183. <input type="button" class="addticket" value="Add Parts" onClick="addpartInput('dynamic#count#Input')">
  184. </td>
  185. </tr>
  186. </table>
  187.  
  188.  
  189. <!---Shows what was previously entered into parts table--->
  190. <!---dbtype="query"--->
  191. <cfquery name="getparts" dbtype="query" >
  192. SELECT *
  193. FROM parts
  194. WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
  195. cfsqltype="cf_sql_char" maxLength="20">
  196. </cfquery>
  197. <cfset count1 = 0>
  198. <!---<cfif serial.recordcount is 0>--->
  199. <cfloop query="getparts">
  200. <cfset count1 = count1 + 1>
  201. <div id="part#count1#Name#count#">
  202. <!---<cfset partliststr = "">
  203. <cfloop from="1" to="#count1#" index="pl">
  204. <cfset partliststr = partliststr & #pl# & ",">
  205. </cfloop>
  206.  
  207. <input type="hidden" name="part2count#count#" id="part2count#count#" value="#partliststr#">
  208. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#">--->
  209.  
  210. <!---THIS IS THE PARTS SECTION--->
  211.  
  212. <input type="hidden" name="pkpartID_#count1#_#count#" id="pkpartID" value="" />
  213.  
  214. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  215. <th class="sectiontitle" colspan="7">Parts Information #count1# Serial Information #count#</th>
  216. <tr>
  217. <td class='indent' id='formfieldpadding'>HC P/N:&nbsp;&nbsp;&nbsp;<input type='text' name="hcpn_#count1#_#count#" style="margin:0px" value=""></td>
  218. <td>
  219. Parts been returned*
  220. <input type="checkbox" name="partsreturn_#count1#_#count#" value=""/>
  221. </td>
  222. <td>
  223. <td class="indent">Defective<input type="checkbox" name="defective_#count1#_#count#"/></td>
  224. </td>
  225. </tr>
  226. </table>
  227. <!---<input type="hidden" name="partscount#count#" id="partscount#count#" value="#count#">--->
  228.  
  229.  
  230. <!--- Shows what was previously entered for RMA Data Only  --->
  231. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  232. <tr>
  233. <td id="paddingformultitop">
  234. RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;
  235. </td>
  236. <td class="rmanmoveinmulti">
  237. ( You may enter up to 1000 characters. )
  238. <br/>
  239. <textarea maxlength="1000" onKeyUp="return rmaismaxlength(this)" onKeyDown="return rmaismaxlength(this)" rows="4" cols="60" name="rma_#count1#_#count#" ></textarea>
  240. </td>
  241. </tr>
  242. </table>
  243.  
  244.  
  245. <!--- Adds Delete to every ticket  --->
  246. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  247. <tr>
  248. <td>
  249. <input type="button" class="removeticket" value="Remove Parts #count1#" 
  250. onclick="removetheElement('part#count1#Name#count#',#count#,#count#)"></a>
  251. </td>
  252. </td>
  253. </tr>
  254. </table>
  255. </div>
  256. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#"/>
  257. </cfloop>
  258. </div>
  259. <!---this one makes it so you can add a part to a previously submitted serial--->
  260. <input type="hidden" name="partcounter#count#" id="partcounter#count#" value="#count1#" />
Thank you,
Rach
Nov 25 '08 #391
acoder
16,027 Expert Mod 8TB
Yes, you'll need a cfoutput tag outside the template.
Nov 25 '08 #392
bonneylake
769 512MB
Hey Acoder,

I am confused so are you saying i do or do not need the last <cfoutput> in the template. An if i don't need it then how do i make it when i didn't fill in a serial, how do i make the template count correctly cause right now it says serial #count# information if i did not fill in a serial.I tried wrapping the whole thing in just <cfoutput> that seemed to work except when you look at the didn't fill in a serial one it makes the serial serial 0 information.

Also, could you explain the serial ordering part. I been looking and trying things all day but i cant seem to get it an it has my curiosity sparked. The only thing i have found online is that people created another field and made it a primary key an they made the data type int and set identiity specification to yes. Which is how my parts is like except i use the id_helper to generate the number instead of idenitity. But i not sure if thats what i need or not. An also when i tempted to try it said that the primary key or unique constraint cannot be changed until its existing relationships are deleted. Do you want to delete the relationship? an well i was afraid it would mess with what we had already done.But would this be a good way to do it or another way to go about it? the biggest problem is for some reason in the parts table the parts are not in order, But yet the serial is in order. would doing this solve the problem of things being in order and instead just put it how i inserted it? in my parts table it puts the fk_ticketNo in order like 2,3,4.An the serials in the order i inserted it like if i did 60, 55 it shows it as

part 1 fk_serialno 60 fk_ticketNo 2 hcpn 6
part 2 fk_serialNo 55 fk_ticketNo2 hcpn 5

Thank you,
Rach
Nov 25 '08 #393
acoder
16,027 Expert Mod 8TB
@bonneylake
To correct this, add a line outside the template which sets count to 1.

Also, could you explain the serial ordering part.
Using a unique field primary key (which increments automatically on each insert) would work. What's the current primary key(s)? You could use a field which is not a primary key, but unique.
Nov 26 '08 #394
bonneylake
769 512MB
Hey Acoder,

The template works perfectly!

The fields i currently have are the following

primary key pka_serialNo nvarchar(100) allows nulls
primary key pkb_fk_ticketNo nvarchar(100) allows nulls
model_no nvarchar(50) does not allow nulls
product_type nvarchar(100) does not allow nulls
software_hardware nvarchar(40) does not allow nulls
resolution nvarchar(1500) does not allow nulls
resolution_date datetime does not allow nulls
verification_date datetime does not allow nulls
type_hardware_failure nvarchar(100) allows nulls
dept_responsibility nvarchar(40) does not allow nulls
resolution_verified_by nvarchar(50) does not allow nulls

the only fields i have in the form that are required are type_hardware_failure and dept_responsibility. But i was thinking about doing the other idea an creating another primary key because in all my other fields i have a similar count except in the serial table. But the only bad thing is, is i already got 2 primary keys as is so i don't know if its a good idea or not.

Thank you,
Rach
Nov 26 '08 #395
acoder
16,027 Expert Mod 8TB
Since the template's working and is basically a copy of the code in the main page, replace that code with the template. This will be more efficient and mean that whenever you make a change, you don't have to make the change in two places.

For the sorting, you could use a unique field that is not a primary key. It can be an autonumber field that increments whenever an update is made. This also means you don't need to change any of your insert/update/delete queries.

A question though: why are the two primary keys allowed to be null?
Nov 26 '08 #396
bonneylake
769 512MB
Hey Acoder,

The thing is what i have on the main page is each field has a value like for example <input type="text" value="#serialnum#"> and on my template i have no value an just have <input type='text" value=""> so should i still take everything out of the main page an put the template?

an i got the count working i added the field pk_snum int allows nulls an then i set idenity specification to yes. But i was wondering is there a way to reset the identity? right now it starts off at 25 an like to set it back to 1 if it was possible so it has a fresh start.


an i have no clue why the primary keys allow nulls because i didn't create it.but all the other tables have the same thing applied to there primary keys as well so no clue.

Thank you,
Rach
Nov 26 '08 #397
acoder
16,027 Expert Mod 8TB
The template was supposed to be exactly the same as the main page code including #serialnum# and other variable values. For serial count 0, you would set these to empty strings, so that even though they're set in the template, they're not set to anything.

For the identity field, numbers are not important as long as you can order by insertion order.
Nov 26 '08 #398
bonneylake
769 512MB
Hey Acoder,

yes i can order by insertion number. I created it an then in my cfquery for serial i added Order by pk_snum an it worked perfectly. Was just trying to figure out if there was away to reset the count to 1 because it started off at 20.

An i am confused by the template part. So basically i was suppose to just make a copy of everything between the serial div, wrap it in cfoutput an then cfset the count to 1 an was not suppose to change the value from having a value to blank correct?

so basically i need to take out everything out starting at the serial div in the main file, replace it with the template from cfset count 1 to the </cfoutput> correct? An then what do i do with the below that appears below the serial div?

Expand|Select|Wrap|Line Numbers
  1. <!---If have any blanks in serial table it will make field appear--->
  2. <cfoutput query="serial">
  3. <cfset model_no = #model_no#>
  4. <cfset product_type = #product_type#>
  5. <cfset type_hardware_failure = #type_hardware_failure#>
  6. <cfset pka_serialNo = #pka_serialNo#>
  7. <cfset software_hardware = #software_hardware#>
  8. <!---<cfloop query="getnotes">
  9. <cfset description = #description#></cfloop>--->
  10. <cfset resolution = #resolution#>
  11. <cfset resolution_date = #resolution_date#>
  12. <cfset resolution_verified_by = #resolution_verified_by#>
  13. <cfset verification_date = #verification_date#>
  14. <cfset dept_responsibility = #dept_responsibility#>
  15. </cfoutput>
  16. <cfif serial.recordcount is 0>
  17. <cfset model_no = "">
  18. <cfset product_type = "">
  19. <cfset type_hardware_failure = "">
  20. <cfset pka_serialNo = "">
  21. <cfset software_hardware = "">
  22. <!---<cfif getnotes.recordcount is 0>
  23. <cfset description = ""></cfif>--->
  24. <cfset resolution = "">
  25. <cfset resolution_date = "">
  26. <cfset resolution_verified_by = "">
  27. <cfset verification_date = "">
  28. <cfset dept_responsibility = "">
  29. <cfinclude template="serialpartsdisplay.cfm">
  30. </cfif>
  31.  
  32. <!---Parts Information, display parts if have or don't have a value--->
  33. <cfoutput query="parts">
  34. <cfset hc_partNo = #hc_partNo#>
  35. <cfset part_returned = #part_returned#>
  36. <cfset defective = #defective#>
  37. <cfset rma_number = #rma_number#>
  38. <!---<cfinclude template="serialpartsdisplaytest.cfm">--->
  39. </cfoutput>
  40. <cfif parts.recordcount is 0>
  41. <cfset hc_partNo = "">
  42. <cfset part_returned = "">
  43. <cfset defective = "">
  44. <cfset rma_number = "">
  45. <!---<cfinclude template="serialpartsdisplaytest.cfm">--->
  46. </cfif>
  47.  
  48. <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
  49. </div>
Thank you,
Rach
Nov 26 '08 #399
acoder
16,027 Expert Mod 8TB
Yes, that's what I meant. Basically, what you have is:
Expand|Select|Wrap|Line Numbers
  1. <cfoutput query="serials">
  2. <cfinclude template...>
  3. </cfoutput>
  4. <cfif serials.recordcount is 0>
  5. <cfset some default values (same names as query)>
  6. <cfinclude template...>
  7. </cfif>
Nov 26 '08 #400

Post your reply

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

Similar topics

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