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

Home Posts Topics Members FAQ

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

displaying previously entered multiple fields

769 512MB
Hey Everyone,

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

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

Currently this is what it does

serial information 1
parts 1
parts 2

serial information 2
parts 1
parts 2

and what it needs to do

serial information 1
parts 1
serial information 2
parts 1

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

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


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

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


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

My bad hcpn is hc_partNo. Its the same thing so its not missing just different naming. An for the parts about coldfusion are you meaning i need to add the pkpartid under the exec like so
Expand|Select|Wrap|Line Numbers
  1. <cfquery name="parts" datasource="CustomerSupport">
  2.    exec usp_CS_Updateinsertparts 
  3.    <cfqueryparam value="#pkpartID#" CFSQLType = "CF_SQL_VARCHAR">,
  4.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  5.    '#Form.pk_ticketID#',
  6.     <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
  7.     <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
  8.     <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
  9.    <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
  10.  </cfquery> 
Thank you,
Rach
Dec 4 '08 #451
acoder
16,027 Expert Mod 8TB
In your stored proc. you have:
Expand|Select|Wrap|Line Numbers
  1.     @fk_serialNo nvarchar(100),
  2.     @fk_ticketNo nvarchar(100),
  3.     @hc_partNo nvarchar(50),
  4.     @part_returned char(10),
  5.     @rma_number nvarchar(1000),
  6.     @defective bit
so pass the fields in the same order. Are you sure you have hcpn there?
Dec 4 '08 #452
bonneylake
769 512MB
Hey Acoder,

Hcpn is in there, hcpn been working fine.the hcpn is where it type the part an i know its going under the right field, but like i said i can't figure out why it wont delete an also now its like duplicating the records. but do i need to add pk_partid in the following?

Expand|Select|Wrap|Line Numbers
  1. <cfquery name="parts" datasource="CustomerSupport">
  2.    exec usp_CS_Updateinsertparts 
  3.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  4.    '#Form.pk_ticketID#',
  5.     <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
  6.     <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
  7.     <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
  8.    <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
  9.  </cfquery> 
an then do i need to add the pk_part id into the delete parts as well like so

Expand|Select|Wrap|Line Numbers
  1. <cfset partList = ArrayToList(partcheck, ",")>
  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="countparts">
  4. <cfset pk_partID= #pk_partID#>
  5. <!---if the part is not found in the list it begins deleteing--->
  6. <cfif not listFind(partList,pk_partID)>
  7. <cfquery name="deleteparts" datasource="CustomerSupport">
  8. exec usp_CS_Deleteparts
  9. <cfqueryparam value="#pk_partID#" CFSQLType = "CF_SQL_VARCHAR">,
  10. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  11. '#Form.pk_ticketID#'
  12.  
  13. </cfquery>
  14. </cfif>
  15. </cfloop>
Thank you,
Rach
Dec 4 '08 #453
acoder
16,027 Expert Mod 8TB
Now I see where part id is declared in your stored procedure.

Yes, in your delete, you would pass part ID as the first parameter.
Dec 4 '08 #454
bonneylake
769 512MB
Hey Acoder,

So would i pass the part as pkpartID or would i pass it as pk_partID? in my partsdisplay.cfm i have

Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="pkpartID_#count1#_#count#" id="pkpartID" value="#pk_partID#" />

here is what i got for delete right now. but it don't delete if i change it from pkpartID to pk_partId it sorta works it will delete parts with different hcpn (sometimes) but not ones with the same name an then at some points it makes duplicate records that i did not insert
Expand|Select|Wrap|Line Numbers
  1. <cfset partList = ArrayToList(partcheck, ",")>
  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="countparts">
  4. <cfset pk_partID= #pk_partID#>
  5.  
  6. <!---if the part is not found in the list it begins deleteing--->
  7. <cfif not listFind(partList,pk_partID)>
  8. <cfquery name="deleteparts" datasource="CustomerSupport">
  9. exec usp_CS_Deleteparts
  10. <cfqueryparam value="#pkpartID#" CFSQLType = "CF_SQL_VARCHAR">,
  11. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  12. '#Form.pk_ticketID#'
  13.  
  14. </cfquery>
  15. </cfif>
  16. </cfloop>
  17.  

Thank you,
Rach
Dec 4 '08 #455
acoder
16,027 Expert Mod 8TB
Add a cfdump for the partlist before the delete loop to see what the contents are.
Dec 4 '08 #456
bonneylake
769 512MB
Hey Acoder,

I was not sure if i was suppose to deleteing as i did the cfdump. but here is where i put the cfdump
Expand|Select|Wrap|Line Numbers
  1. <cfdump var="#form#">
  2. <!---THIS DELETES FOR THE PARTS TABLE--->
  3. <!---setting a list for parts--->
  4. <cfset partList = ArrayToList(partcheck, ",")>
  5. <!---when inserting/updating for part's table is done it then delete parts not being updated/inserted or was to be deleted on purpose--->
  6. <cfloop query="countparts">
  7. <cfset pk_partID= #pk_partID#>
  8.  
  9. <!---if the part is not found in the list it begins deleteing--->
  10. <cfif not listFind(partList,pk_partID)>
  11. <cfquery name="deleteparts" datasource="CustomerSupport">
  12. exec usp_CS_Deleteparts
  13. <cfqueryparam value="#pk_partID#" CFSQLType = "CF_SQL_VARCHAR">,
  14. <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  15. '#Form.pk_ticketID#'
  16.  
  17. </cfquery>
  18. </cfif>
  19. </cfloop>
an here is what the cfdump says

Expand|Select|Wrap|Line Numbers
  1. ADDRESS  
  2. ATTACHMENT1  
  3. CITY  
  4. COMPANYNAME  
  5. COMPNAME  
  6. CONTACT Check box first!  
  7. COSTCENTERID  
  8. CUSTNOTES  
  9. CUSTNUM 96  
  10. CUSTOMER 96  
  11. DEFECTIVE 0  
  12. DEFECTIVE_2_1 0  
  13. DEPTVENDOR_1 Unknown at this time  
  14. DESCRIPTION1  
  15. EMAIL  
  16. ENTITY  
  17. FIELDNAMES PK_TICKETID,LAST_EDITED_BY,PKB_FK_TICKETNO,PKA_SERIALNO,FK_TICKETNO,FK_TICKETNO,FK_ADDEDBY,FK_ADDEDBY,TITLE,PRIORITY,STATUS,CUSTNUM,CUSTOMER,COMPNAME,FNAME,LNAME,ADDRESS,CITY,STATE,ZIP,EMAIL,PRIPHONE,SECPHONE,CUSTNOTES,COSTCENTERID,SUBMISSION,FOLLOWDATE,ONSITE,NUMONSITE,MODELNO_1,PRODUCTTYPE_1,HARDWAREFAILURE_1,SERIALNUM_1,SOFTHARDWARE_1,PK_NUM_1,THEDESCRIPTION_1,RESOLUTION_1,RESDATE_1,RESVERTIFIED_1,VERTIFIDATE_1,DEPTVENDOR_1,SERIALCOUNT,PKPARTID_1_1,HCPN_1_1,RMA_1_1,PARTSCOUNT1,PARTCOUNTER1,THEVALUE,ATTACHMENT1,DESCRIPTION1,UPLOADS,CONTACT,SUBMIT  
  18. FK_ADDEDBY  
  19. FK_TICKETNO 6,6  
  20. FNAME  
  21. FOLLOWDATE 01/01/1900  
  22. HARDWAREFAILURE_1 Infant Mortality  
  23. HCPN_1_1 test1  
  24. HCPN_2_1  
  25. HTPP 0  
  26. LAST_EDITED_BY  
  27. LNAME  
  28. MODELNO_1  
  29. NUMONSITE 0  
  30. ONSITE No  
  31. PARTCOUNTER1 2  
  32. PARTSCOUNT1 2  
  33. PARTSRETURN 0  
  34. PARTSRETURN_2_1 0  
  35. PK_NUM  
  36. PK_NUM_1  
  37. PK_TICKETID 6  
  38. PKA_SERIALNO test1  
  39. PKB_FK_TICKETNO 6  
  40. PKPARTID_1_1 106  
  41. PKPARTID_2_1  
  42. PRIORITY urgent  
  43. PRIPHONE  
  44. PRODUCTTYPE_1  
  45. RESDATE_1 01/01/1900  
  46. RESOLUTION_1  
  47. RESVERTIFIED_1  
  48. RMA_1_1  
  49. RMA_2_1  
  50. SCHOOLNAME  
  51. SECPHONE  
  52. SERIALCOUNT 1  
  53. SERIALNUM_1 test1  
  54. SOFTHARDWARE_1  
  55. STATE  
  56. STATENAME  
  57. STATUS Closed  
  58. SUBMISSION  
  59. SUBMIT submit  
  60. SUBMITTED_BY submittedby  
  61. THEDESCRIPTION  
  62. THEDESCRIPTION_1  
  63. THEVALUE 1  
  64. TITLE no serial  
  65. TOBOX  
  66. UPLOADS 1  
  67. VERTIFIDATE_1 01/01/1900  
  68. ZIP 
Thank you,
Rach
Dec 4 '08 #457
acoder
16,027 Expert Mod 8TB
I meant for partList or partcheck, but this should maybe help to see the values. Look for the part IDs. Are they what you expect?
Dec 4 '08 #458
bonneylake
769 512MB
Hey Acoder,



ok i figured out partcheck. I did a test of inserting test 1 and test 2. When i inserted all that came up for partcheck was the below with no partID (like it should)
1
2
3
however, it should not have 3 parts i inserted, because i only inserted 2 (althought i don't see a 3rd in one the table).
but when i looked below i had parts 0, parts 1, parts 2 (althought i inserted 2 parts only). When i went to look back at the results i had test 1, test 2. I deleted test 1 which is pk number 122 (test 2 is 123). When i clicked submit the part check says 1. 123, an when you look below it says part 2 (like it should).
When i look back at the results again after deleteing test 1 i see test 2 appear twice. the first holding 123 (like it should) the second holding 124.Its like its deleteing like it should but updating like its not suppose to.

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

Thank you,
Rach
Dec 4 '08 #459
bonneylake
769 512MB
Hey Acoder,

To update from post 459. I ended up moving this from serialpartsdisplay.cfm to underneath the ending div on partsdisplay.cfm

Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#"/>
  2.  
this seemed to make the parts 0 stop appearing each time.

an then in my stored procedure i changed it to the following an got rid of declare

Expand|Select|Wrap|Line Numbers
  1. (@pk_partID nvarchar(55),
  2.     @fk_serialNo nvarchar(100),
  3.     @fk_ticketNo nvarchar(100),
  4.     @hc_partNo nvarchar(50),
  5.     @part_returned char(10),
  6.     @rma_number nvarchar(1000),
  7.     @defective bit
  8.     )
  9.  
an in my cfquery i added

Expand|Select|Wrap|Line Numbers
  1. <cfquery name="parts" datasource="CustomerSupport">
  2.    exec usp_CS_Updateinsertparts 
  3. <!---   --->
  4.    <cfqueryparam value="#pkpartID#" CFSQLType = "CF_SQL_VARCHAR">,
  5.    <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
  6.    '#Form.pk_ticketID#',
  7.     <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
  8.     <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
  9.     <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
  10.    <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
  11.  </cfquery> 
  12.  
This seemed to stop the duplicated (adding records that i didn't want added) an it let me delete any record i choose.

the remaining problem still is on printticketedit.cfm when i delete a part it shows an empty part for it when it shouldnt.this is what i am doing for parts on printticketedit.cfm

Expand|Select|Wrap|Line Numbers
  1. <cfloop list="#form['partscount' & machinecount]#" index="ps">
  2.  <CFSET pkpartID        = Form["pkpartID_" & "#ps#" & "_#machinecount#"]>
  3.  <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
  4.  <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
  5.  <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
  6.   <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
  7. <fieldset> 
  8. <legend>Parts information #ps# Serial information #machinecount#</legend>  
  9. <ol>  
  10. <li>  <label for="HC P/N">HC P/N::</label>
  11. #hcpn#<br/>
  12. </li>
  13. <li>
  14. <label for="have all parts been returned">Parts been returned:</label>
  15. <cfswitch expression="#evaluate(partsreturn)#
  16. ">
  17. <cfcase value="0" delimiters=",">
  18. No
  19. </cfcase>
  20. <cfcase value="1" delimiters=",">
  21. Yes
  22. </cfcase>
  23. </cfswitch>
  24. <br/>
  25. </li>
  26. <li>
  27. <label for="defective">Defective:</label>
  28. <cfswitch expression="#evaluate(defective)#">
  29. <cfcase value="0" delimiters=",">
  30. No
  31. </cfcase>
  32. <cfcase value="1" delimiters=",">
  33. Yes
  34. </cfcase>
  35. </cfswitch><br/>
  36. </li>
  37. <li>
  38. <label for="rma data only">RMA Data Only:</label>
  39. #rma#<br/>
  40. </li>
  41.  </ol>
  42.  </fieldset>
  43.   </CFLOOP>
  44.  
Thank you,
Rach
Dec 4 '08 #460
bonneylake
769 512MB
Hey Acoder,

First off i am sorry about all 3 posts, but i think i got it figured out! I realized that when i delete the hcpn number disappears so i used the following for printticketedit.cfm an it worked.

Expand|Select|Wrap|Line Numbers
  1. <cfloop list="#form['partscount' & machinecount]#" index="ps">
  2.  <CFSET pkpartID        = Form["pkpartID_" & "#ps#" & "_#machinecount#"]>
  3.  <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
  4.  <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
  5.  <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
  6.   <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
  7. <cfif hcpn neq "">
  8. <fieldset> 
  9. <legend>Parts information #ps# Serial information #machinecount#</legend>  
  10. <ol>  
  11. <li>  <label for="HC P/N">HC P/N::</label>
  12. #hcpn#<br/>
  13. </li>
  14. <li>
  15. <label for="have all parts been returned">Parts been returned:</label>
  16. <cfswitch expression="#evaluate(partsreturn)#">
  17. <cfcase value="0" delimiters=",">
  18. No
  19. </cfcase>
  20. <cfcase value="1" delimiters=",">
  21. Yes
  22. </cfcase>
  23. </cfswitch>
  24. <br/>
  25. </li>
  26. <li>
  27. <label for="defective">Defective:</label>
  28. <cfswitch expression="#evaluate(defective)#">
  29. <cfcase value="0" delimiters=",">
  30. No
  31. </cfcase>
  32. <cfcase value="1" delimiters=",">
  33. Yes
  34. </cfcase>
  35. </cfswitch><br/>
  36. </li>
  37. <li>
  38. <label for="rma data only">RMA Data Only:</label>
  39. #rma#<br/>
  40. </li>
  41.  </ol>
  42.  </fieldset>
  43. <cfelse>
  44.  </cfif>
  45.   </CFLOOP>
but let me know after you read all 3 posts (which again sorry for so many) if what i have done will be ok/work. It looks like it works good an i have done lots of tests but i just wanna make sure it will be ok before i leave it at where i have it.

Thank you :),
Rach
Dec 4 '08 #461
acoder
16,027 Expert Mod 8TB
That looks good. I now see how the duplicates might have appeared. As for the hcpn, I'm not sure exactly how that solves the problem, but you know the inner workings of the system better than me.

Good work, and I actually prefer when you use another post to describe something because you can see the trail of effort and thought rather than an edit.
Dec 5 '08 #462
bonneylake
769 512MB
Hey Acoder,

Well the reason i am using the hcpn is because what happens is when i delete a part. Instead of not showing the part when i delete it still shows the part i deleted just empty, like hcpn an all the fields are just empty. So if i check if the hcpn is empty then if it is empty it wont show up. But if you have another solution or a better way i could go about that let me know. I don't know why it shows when i delete a part, before the new changes if i deleted a part it wouldn't appear. But i am doing it as i did in the last post.

An i am relieved that i didn't annoy you with all the posts. i was thinking he is going to be going oh no look at all these posts! so i am relieved lol. But thank you so much for all the help you have no idea how much i appreciate it all :)

Thank you again :),
Rach
Dec 5 '08 #463
acoder
16,027 Expert Mod 8TB
That does seem like a fix because if it's deleted, it shouldn't show up. Where and when is this print page called?
Dec 5 '08 #464
bonneylake
769 512MB
Hey Acoder,

After all the information is submitted. It appears at the end of userformedit.cfm as a template. so would this be an ok solution or could there be another way? like i said it didn't start doing this till after i made the changes.

i have also noticed another problem. My checkboxs are not working. If i click yes it will not change to yes it remains no an its only for the parts section. Here is how i am displaying it on partsdisplay.cfm
Expand|Select|Wrap|Line Numbers
  1. <input type="checkbox" name="partsreturn_#count1#_#count#" value="#part_returned#"
  2. <cfif #part_returned# eq "1">checked=yes</cfif>/>
  3.  
  4. <input type="checkbox" name="defective_#count1#_#count#" 
  5. value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/>
  6.  
i have done all the other fields in my form this way, any ideas?


Thank you,
Rach
Dec 5 '08 #465
bonneylake
769 512MB
Hey Acoder,

I havent gotten any further on the checkboxes. The only thing i know is when i insert for the first time a part if i have it as checked or yes i have no problem changing the checkbox from yes to no back to yes. But if i submit it as no i can not get it to go back to yes. i also have figured this out with another field, in one section if i go back to cticketpage1edit.cfm if i submitted htpp as no to begin with if i try to change it to yes an submit it it wont do it, it wont even submit.but i am doing them all the same which is like so

Expand|Select|Wrap|Line Numbers
  1. <input type="checkbox" name="defective_#count1#_#count#" 
  2. value="#defective#"<cfif #defective# eq "1">checked=yes</cfif> /
Thank you,
Rach
Dec 5 '08 #466
acoder
16,027 Expert Mod 8TB
Check the database. Is it deleted from the database?
Re. checkboxes: Try something like:
Expand|Select|Wrap|Line Numbers
  1. <input type="checkbox" name="partsreturn_#count1#_#count#" value="1"
  2. <cfif Val(part_returned) eq 1>checked</cfif>/>
Dec 5 '08 #467
bonneylake
769 512MB
Hey Acoder,

Yes parts is being delete from the table. An that worked perfectly for the checkbox.

I don't know if this would help but this is what my print ticket looks like

Expand|Select|Wrap|Line Numbers
  1.  <CFLOOP list="#form.serialcount#" index="machineCount">
  2.  <CFSET serialnum       = "Form.serialnum_" & machineCount>
  3.  <CFSET modelno         = "Form.modelno_" & machineCount>
  4.  <CFSET producttype     = "Form.producttype_" & machineCount>
  5.  <CFSET softhardware    = "Form.softhardware_" & machineCount>
  6.  <CFSET resolution      = "Form.resolution_" & machineCount>
  7.  <CFSET resdate         = "Form.resdate_" & machineCount>
  8.  <CFSET resvertified    = "Form.resvertified_" & machineCount>
  9.  <CFSET vertifidate     = "Form.vertifidate_" & machineCount>
  10.  <CFSET deptvendor      = "Form.deptvendor_" & machinecount>
  11.  <CFSET hardwarefailure = "Form.hardwarefailure_" & machineCount>
  12.  <CFSET thedescription  = "Form.thedescription_" & machineCount>
  13.  <fieldset> 
  14. <legend>Serial information #machinecount#</legend>  
  15. <ol>
  16. <li>
  17. <label for="model no">Model No:</label>
  18. #evaluate(modelno)#<br/>
  19. </li>
  20. <li>
  21. <label for="product type">Product Type:</label>
  22. #evaluate(producttype)#<br/>
  23. </li>  
  24. <li>
  25. <label for="type of hardware failure">Type of Hardware Failure:</label>
  26. #evaluate(hardwarefailure)#<br/>
  27. </li>
  28. <li>  <label for="serial number">Serial Number:</label>
  29. #evaluate(serialnum)#<br/>
  30. </li>
  31. <li>
  32. <label for="software/hardware">Software/Hardware:</label>
  33. #evaluate(softhardware)#<br/>
  34. </li>
  35. <li>
  36. <label for="description">Description:</label>
  37. #evaluate(thedescription)#<br/>
  38. </li>
  39. <li>
  40. <label for="resolution">Resolution:</label>
  41. #evaluate(resolution)#<br/>
  42. </li>
  43. <li>
  44. <label for="resolution date">Resolution Date:</label>
  45. #evaluate(resdate)#<br/>
  46. </li>
  47. <li>
  48. <label for="resolution verified as effective by">Resolution Verified as effective by:</label>
  49. #evaluate(resvertified)#<br/>
  50. </li>
  51. <li>
  52. <label for="verification date">Verification Date:</label>
  53. #evaluate(vertifidate)#<br/>
  54. </li>
  55. <li>
  56. <label for="dept./vendor responsibility">Dept./Vendor Responsibility:</label>
  57. #evaluate(deptvendor)#<br/>
  58. </li>
  59.  </ol>
  60.  </fieldset>
  61.  
  62. <cfloop list="#form['partscount' & machinecount]#" index="ps">
  63.  <CFSET pkpartID        = Form["pkpartID_" & "#ps#" & "_#machinecount#"]>
  64.  <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
  65.  <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
  66.  <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
  67.   <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
  68. <cfif hcpn neq "">
  69. <fieldset> 
  70. <legend>Parts information #ps# Serial information #machinecount#</legend>  
  71. <ol>  
  72. <li>  <label for="HC P/N">HC P/N:</label>
  73. #hcpn#<br/>
  74. </li>
  75. <li>
  76.  
  77. <label for="have all parts been returned">Parts been returned:</label>
  78. <cfswitch expression="#evaluate(partsreturn)#">
  79. <cfcase value="0" delimiters=",">
  80. No
  81. </cfcase>
  82. <cfcase value="1" delimiters=",">
  83. Yes
  84. </cfcase>
  85. </cfswitch>
  86. <br/>
  87. </li>
  88. <li>
  89. <label for="defective">Defective:</label>
  90. <cfswitch expression="#evaluate(defective)#">
  91. <cfcase value="0" delimiters=",">
  92. No
  93. </cfcase>
  94. <cfcase value="1" delimiters=",">
  95. Yes
  96. </cfcase>
  97. </cfswitch><br/>
  98. </li>
  99. <li>
  100. <label for="rma data only">RMA Data Only:</label>
  101. #rma#<br/>
  102. </li>
  103.  </ol>
  104.  </fieldset>
  105. <cfelse>
  106.  </cfif>
  107.   </CFLOOP>
  108.  </cfloop>
  109.  </cfoutput>
Thank you :),
Rach
Dec 5 '08 #468
acoder
16,027 Expert Mod 8TB
If it's after submission, you don't need to use the form fields. You can use the database to show the current data.
Dec 5 '08 #469
bonneylake
769 512MB
Hey Acoder,

I am confused by what you mean. Even if i take the form fields out like below i am still getting the same results

Expand|Select|Wrap|Line Numbers
  1. <cfloop list="#form['partscount' & machinecount]#" index="ps">
  2. <fieldset> 
  3. <legend>Parts information #ps# Serial information #machinecount#</legend>  
  4. <ol>  
  5. <li>  <label for="HC P/N">HC P/N:</label>
  6. #hcpn#<br/>
  7. </li>
  8. <li>
  9.  
  10. <label for="have all parts been returned">Parts been returned:</label>
  11. <cfswitch expression="#evaluate(partsreturn)#">
  12. <cfcase value="0" delimiters=",">
  13. No
  14. </cfcase>
  15. <cfcase value="1" delimiters=",">
  16. Yes
  17. </cfcase>
  18. </cfswitch>
  19. <br/>
  20. </li>
  21. <li>
  22. <label for="defective">Defective:</label>
  23. <cfswitch expression="#evaluate(defective)#">
  24. <cfcase value="0" delimiters=",">
  25. No
  26. </cfcase>
  27. <cfcase value="1" delimiters=",">
  28. Yes
  29. </cfcase>
  30. </cfswitch><br/>
  31. </li>
  32. <li>
  33. <label for="rma data only">RMA Data Only:</label>
  34. #rma#<br/>
  35. </li>
  36.  </ol>
  37.  </fieldset>
  38.   </CFLOOP>
  39.  </cfloop>
  40.  </cfoutput>
i also tried to just cfloop query="parts" around the whole section an that seemed to cause the same effect.

Thank you,
Rach
Dec 5 '08 #470
acoder
16,027 Expert Mod 8TB
By that, I meant a new query and loop over the results.

You may be able to work with the form fields too, but it'd require adding all of that code that you used earlier for adding/updating/deleting to display the correct current information.
Dec 5 '08 #471
bonneylake
769 512MB
Hey Acoder,

I think i know what the problem is an i could cry. I forgot in my serialpartsdisplay.cfm i did this.
Expand|Select|Wrap|Line Numbers
  1. <cfset count1 = 0>
  2. <cfloop query="getparts">
  3. <cfset count1 = count1 + 1>
  4. <cfset hc_partNo = #hc_partNo#>
  5. <cfset part_returned = #part_returned#>
  6. <cfset defective = #defective#>
  7. <cfset rma_number = #rma_number#>
  8. <cfinclude template="partsdisplay.cfm">
  9.    </cfloop>
  10.  
  11. <cfif serial.recordcount is 0 and getparts.recordcount is 0>
  12.  <cfset count1 = 1>
  13. <cfset hc_partNo = "">
  14. <cfset part_returned = "">
  15. <cfset defective = ""> 
  16. <cfset rma_number = "">
  17. <cfinclude template="partstest.cfm">
  18.  </cfif>
  19.  
basically partstest.cfm is a copy of partsdisplay.cfm without the hidden line for pkpartID. An well i tried to change it back to partsdisplay.cfm but now it wont work (again). It will work if have parts, but if don't have parts i get an error an its an administrator error. If i comment out pkpartID the part will appear when no serial are filled out, however if pkpartID is not commented out it gives an error.Is there anyway to have pk_partID in partsdisplay.cfm an not in partsdisplay.cfm at the same time? here is what i got on partsdisplay.cfm. here is what i got on

partsdisplay.cfm

Expand|Select|Wrap|Line Numbers
  1. <cfoutput>
  2. <div id="part#count1#Name#count#">
  3.  
  4.  
  5. <input type="hidden" name="pkpartID_#count1#_#count#" id="pkpartID" value="#pk_partID#" />
  6.  
  7. <!---<cfset partliststr = "">
  8. <cfloop from="1" to="#count1#" index="pl">
  9. <cfset partliststr = partliststr & #pl# & ",">
  10. </cfloop>
  11.  
  12. <input type="hidden" name="part2count#count#" id="part2count#count#" value="#partliststr#">
  13. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#">--->
  14.  
  15. <!---THIS IS THE PARTS SECTION--->
  16.  
  17.  
  18.  
  19. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  20. <th class="sectiontitle" colspan="7">Parts Information #count1# Serial Information #count#</th>
  21. <tr>
  22. <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>
  23. <td>
  24. Parts been returned
  25. <input type="checkbox" name="partsreturn_#count1#_#count#" value="1"<cfif Val(part_returned) eq 1>checked</cfif>/>
  26. </td>
  27. <td>
  28. <td class="indent">Defective<input type="checkbox" name="defective_#count1#_#count#" 
  29. value="1"<cfif Val(defective) eq 1>checked</cfif> /></td>
  30. </td>
  31. </tr>
  32. </table>
  33. <!---<input type="hidden" name="partscount#count#" id="partscount#count#" value="#count#">--->
  34.  
  35.  
  36. <!--- Shows what was previously entered for RMA Data Only  --->
  37. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  38. <tr>
  39. <td id="paddingformultitop">
  40. RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;
  41. </td>
  42. <td class="rmanmoveinmulti">
  43. ( You may enter up to 1000 characters. )
  44. <br/>
  45.  
  46. <textarea maxlength="1000" onkeyup="return rmaismaxlength(this)" onkeydown="return rmaismaxlength(this)" rows="4" cols="60" name="rma_#count1#_#count#" >#rma_number#</textarea></td>
  47. </tr>
  48. </table>
  49.  
  50.  
  51. <!--- Adds Delete to every ticket  --->
  52. <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
  53. <tr>
  54. <td>
  55.  
  56. <input type="button" class="removeticket" value="Remove Parts #count1#" 
  57. onclick="removetheElement('part#count1#Name#count#',#count#,#count#)">
  58. </td>
  59. </td>
  60. </tr>
  61. </table>
  62.  
  63.  
  64. </div>
  65. <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#"/>
  66. </cfoutput>
  67.  
  68.  


Thank you,
Rach
Dec 5 '08 #472
acoder
16,027 Expert Mod 8TB
You need to add
Expand|Select|Wrap|Line Numbers
  1. <cfset pk_partID = "">
but I have a question. If a part is empty, it won't have a part ID, so how is that dealt with. I could look back at your previous posts/code, but trying to sieve through all that code would be a bit of a mission!
Dec 5 '08 #473
bonneylake
769 512MB
Hey Acoder,

That worked perfectly!!! but i am going to do some more tests after lunch an DOUBLE check to make sure.An i don't blame you one bit for not wanting to look back at the post lol

But ok here is how it is working. If a part ID exists, it will update. However, if a part ID does not exist it will insert a new record. So basically if you took firebug an looked at it (at a previous part) you would see with each part it has a part id associated, but if you add a part no part id associated. However, if you submitted that part with no part id, if you went back an looked at cticketpage2edit.cfm an used firebug you would see it got assigned a part id after submission.

but thank you so much for the help, all come back after i do more tests an let you know if this thread can finally be put to rest. But thank you again for all the help!!!

Thank you :),
Rach
Dec 5 '08 #474
acoder
16,027 Expert Mod 8TB
Well, a small fix in the end as it is the case with a lot of problems. Hopefully that's the last of them :)

It does make sense how you're using the part ID.
Dec 5 '08 #475
bonneylake
769 512MB
Hey Acoder,

I do got one last problem. For some reason i can insert attachments fine. But when i go to cticketpage2edit.cfm an try to add more attachments it wont let me download them on to the table. So i was wondering could what we did to serials and parts mess with it?

Thank you
Rach
Dec 5 '08 #476
bonneylake
769 512MB
Hey Acoder,

I figured out attachments, i needed to change one word in it. But i also realized that to download a file you need a serial, is there anyway to put like a blank entry in the serial section of attachments so that they could still upload attachments? here is what i am using for attachments now

Expand|Select|Wrap|Line Numbers
  1. <!---Inserts attachments into attachments.--->
  2.       <cfif structKeyExists(FORM, "uploads")>
  3.            <cfset currentDirectory = GetDirectoryFromPath(GetTemplatePath()) & "uploaded">
  4.            <cfparam name="FORM.uploads" default="">
  5.            <cfloop list="#form.uploads#" index="counter">
  6.             <cfset currentDescription = form["description" & counter]>
  7.       <!---      verify the form field exists --->
  8.            <cfif structKeyExists(FORM, "attachment"& counter)>
  9.            <!---      try and upload it ...--->
  10.                 <cftry>
  11.            <cfif Len(FORM["attachment#counter#"])>
  12.                 <cffile action="upload" fileField="form.attachment#counter#" destination="C:\Inetpub\Development\WWWRoot\RachelB\footprints\form\attachments\" nameconflict="MAKEUNIQUE">
  13.                 <cfset filename = cffile.ClientFileName & "_" & form.pk_ticketID & "_" & counter & "." & cffile.ClientFileExt>
  14.   <!---  IF RUN INTO PROBLEMS WITH FILES NOT GOING INTO TABLE MAKE SURE EVERYTHING BETWEEN SOURCE="" IS ALL ON ONE LINE--->
  15.      <CFFILE ACTION="RENAME" SOURCE="C:\Inetpub\Development\WWWRoot\RachelB\footprints\form\attachments\#CFFILE.ServerFile#" 
  16.      destination="C:\Inetpub\Development\WWWRoot\RachelB\footprints\form\attachments\#filename#">
  17.                     <cfquery name="attachment" datasource="CustomerSupport">
  18.           exec usp_CS_UpdateInsertattachments
  19.       '#Form.pk_ticketID#','#serialnum#','#currentDescription#','#filename#','#Form.fk_addedBy#'
  20.       </cfquery>
  21.               </cfif>
  22.                 <cfcatch><!--- do something here, e.g. display error message.. --->
  23.            </cfcatch>
  24.            </cftry>
  25.            </cfif>
  26.            </cfloop>
  27.       </cfif>
but besides that serials and parts are working perfectly :).

Thank you again for all the help :),
Rach
Dec 5 '08 #477
acoder
16,027 Expert Mod 8TB
I'm not sure I quite understand what you mean here: @bonneylake
So you want users to be able to upload attachments without depending on serials?
Dec 5 '08 #478
bonneylake
769 512MB
Hey Acoder,

Yes that is correct. Right now they can submit contact information without a serial or part. But if you try to upload an attachment it wont let you put it in the database without a serialnum.

Thank you,
Rach
Dec 5 '08 #479
acoder
16,027 Expert Mod 8TB
The problem is that attachments are linked/attached to a serial. Change the database to only link attachments to the ticket by removing serial number and then change your Coldfusion code accordingly.
Dec 6 '08 #480
bonneylake
769 512MB
Hey Acoder,

Well i thought about it over the weekend an i realize theres no point to allowing users to upload attachments if there is no serials. I thought it would be cool to do it in case the situation came up. But the point of attachments is that if they have serials its suppose to go with all the serials for that ticket. So i think i am going to leave it for now unless they decide later they need to upload attachments without a serial. But i wanted to say thank you again for all the help you have given me. you have no idea how much i appreciated it!!!

Thank you again :),
Rach
Dec 8 '08 #481
acoder
16,027 Expert Mod 8TB
You're welcome. It's no problem at all.

PS. we didn't quite make it to 500 ;D
Dec 8 '08 #482
bonneylake
769 512MB
Hey Acoder,

Yes i am glade we didn't make it to 500 either lol. Its long enough an hard to go through as is (tried to the other day). But again Thank You for all the help :)


Thank you again :),
Rach
Dec 9 '08 #483

Post your reply

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

Similar topics

4 posts views Thread by Vigneshwar Pilli via DotNetMonster.com | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | 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.