473,836 Members | 1,410 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to loop through this?

769 Contributor
Hey Everyone,

What i am trying to do is show previously entered information. I know i need a loop for this , but i am not sure how to loop through this based on my form appears all in the javascript

here is my code
Expand|Select|Wrap|Line Numbers
  1. <cfquery name="serial" datasource="CustomerSupport">
  2.         SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware,resolution,resolution_date,
  3.          verification_date,rma_data,type_hardware_failure,dept_responsibility,resolution_verified_by FROM dbo.tbl_CS_serial
  4. </cfquery>
  5.  
  6. <cfoutput query="serial">
  7. <cfset model_no = #model_no#>
  8. <cfset product_type = #product_type#>
  9. <cfset type_hardware_failure = #type_hardware_failure#>
  10. <cfset software_hardware = #software_hardware#>
  11. <cfset resolution_verified_by = #resolution_verified_by#>
  12. <cfset dept_responsibility = #dept_responsibility#>
  13. </cfoutput>
  14.  
  15. <script type="text/javascript">
  16.  
  17. <!---Allows us to show previous fields --->
  18.  
  19. function showInput(divName){
  20. var dynamic = document.getElementById('dynamicInput');
  21. var thevalue = document.getElementById('theValue');
  22. var count = (document.getElementById('theValue').value -1)+ 2;
  23. thevalue.value = count;
  24. var newdiv = document.createElement('div');
  25. var divIdName = 'dynamic'+count+'Input';
  26. newdiv.setAttribute('id',divIdName);
  27.  
  28.  
  29. <!--- Adds Extra fields for Model No, Product Type, and Type of Hardware Failure  --->
  30. newdiv.innerHTML =
  31.  
  32. "<table class='zpExpandedTable' id='modeltable'>" +
  33. "<th class='sectiontitletick' colspan='7'>Serial Information "+ count +" </th>" +
  34. "<tr>" +
  35. "<td id='paddingformultitop'>Model No:&nbsp;&nbsp;&nbsp;&nbsp;</td>" +
  36. "</td>" +
  37. "<td>" +
  38.  "<select name='modelno_" + count + "'>" +
  39.  "<option value=''>Make A Selection</option>" +
  40. "<cfoutput query='models'>" + 
  41. "<option value='#model#'<cfif #model# is #evaluate(model_no)#>selected</cfif>>#model#</option>" + 
  42. "</cfoutput>" + 
  43.  "</select>" +
  44.  "</td>" +
  45.  "<td>" +
  46. "&nbsp;&nbsp;&nbsp;&nbsp;Product Type:"  +
  47. "</td>" +
  48. "<td>" +
  49. "<select name='producttype_" + count + "'>" +
  50. "<option value='' selected>No Choice</option>" +
  51. "<cfoutput query='getProdType'>" + 
  52. "<option value='#pk_productType#'<cfif #pk_productType# is #product_type#>selected</cfif>>#pk_productType#</option>" + 
  53. "</cfoutput>" + 
  54. "</select>" +
  55. "</td>" +
  56. "<td class='red'>" +
  57. "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type Of Hardware Failure*:" +
  58. "</td>" +
  59. "<td>" +
  60. "<select name='hardwarefailure_" + count + "'>" +
  61. "<option value='' selected>Make A Selection</option>" +
  62. "<cfoutput query='getHardwareFail'>" +
  63. "<option value='#pk_hardwareFailure#'<cfif #pk_hardwareFailure# is #type_hardware_failure#>selected</cfif>>#pk_hardwareFailure#</option>" +
  64. "</cfoutput>" +
  65. "</select>" +
  66. "</td>" +
  67. "</tr>" +
  68. "<table>";
  69.  
  70. <!--- Adds Extra fields for Serial Number and Software/Hardware  --->
  71. newdiv.innerHTML = newdiv.innerHTML +
  72. "<table class='zpExpandedTable' id='modeltable'>" +
  73. "<tr>" +
  74. "<td id='paddingformultitop'>" +
  75. "Serial Number:&nbsp;&nbsp;" +
  76. "<cfoutput query="serial"><input type='text' name='serialnum_" + count + "' value='#pka_serialNo#' ></cfoutput>" +
  77. "&nbsp;&nbsp;&nbsp;&nbsp;Software/Hardware:&nbsp;&nbsp;" +
  78. "<select name='softhardware_" + count + "'>" +
  79. "<option value='' selected>No Choice</option>" +
  80. "<cfoutput query='getSoftHard'>" + 
  81. "<option value='#pk_softwareHardware#'<cfif #pk_softwareHardware# is #software_hardware#>selected</cfif>>#pk_softwareHardware#</option>" + 
  82. "</cfoutput>" + 
  83. "</select>" +
  84. "</td>" +
  85. "</tr>" +
  86. "</table>";
  87.  
  88. <!--- Adds Extra fields for Description ---> 
  89. newdiv.innerHTML = newdiv.innerHTML + 
  90. "<table class='zpExpandedTable' id='resoltable' cellpadding='3' cellspacing='0'>" +
  91. "<tr>" +
  92. "<td id='paddingformutli'>" +
  93. "Description:&nbsp;&nbsp;" + 
  94. "</td>" +
  95. "<td class='descriptionmoveinmulti'>" +
  96. "( You may enter up to 500 characters. )"+
  97. "<br>" +
  98. "<cfoutput query="description"><textarea maxlength='500' onkeyup='return ismaxlength(this)' onkeydown='return ismaxlength(this)'rows='4' cols='60' name='thedescription_" + count + "'>#description#</textarea></cfoutput>" + 
  99. "</td>" +
  100. "</tr>" +
  101. "</table>";
  102.  
  103. <!--- Adds Extra fields for Resolution  --->
  104. newdiv.innerHTML = newdiv.innerHTML +
  105. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  106. "<tr>" +
  107. "<td id='paddingformutli'>" +
  108. "Resolution:&nbsp;&nbsp;" +
  109. "</td>" +
  110. "<td class='resolutionmoveinmulti'>" +
  111. "( You may enter up to 500 characters. )"+
  112. "<br>" +
  113. "<cfoutput query='serial'><textarea  maxlength='500' onkeyup='return ismaxlength(this)' onkeydown='return ismaxlength(this)' rows='4' cols='60' name='resolution_" + count + "'>#resolution#</textarea></cfoutput>" +
  114. "</td>" +
  115. "</tr>" +
  116. "</table>";
  117.  
  118. <!--- Adds Extra fields for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by  --->
  119. newdiv.innerHTML = newdiv.innerHTML +
  120. "<table class='zpExpandedTable' id='resoldatetab' cellpadding='1' cellspacing='0'>" +
  121. "<tr>" +
  122. "<td id='paddingformultitop'>" +
  123. "Resolution Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;" +
  124. "</td>" +
  125. "<td>" +
  126. "<cfoutput query='serial'><input type='text' name='resdate_" + count + "' value='#resolution_date#'>&nbsp;&nbsp;</cfoutput>" +
  127.  
  128. "&nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;" +
  129. "<input type='checkbox' name='currentdateresol_" + count + "' onClick=resdate_" + count + ".value=fill_date()>" +
  130. "</td>" +
  131. "<td>" +
  132. "Resolution Verified as effective by:&nbsp;&nbsp;"  +
  133. "</td>" +
  134. "<td>" +
  135. "<select name='resvertified_" + count + "'>" +
  136. "<option value='' selected>Make A Selection</option>" +
  137. "<cfoutput query='gettech'>" +
  138. "<option value='#fname# #lname#'<cfif "#fname# #lname#" is #resolution_verified_by#>selected</cfif>>#fname# #lname#</option>" +
  139. " </cfoutput>" +
  140. "</select>" +
  141. "</td>" +
  142. "</tr>" +
  143. "</table>";
  144.  
  145.  
  146. <!--- Adds Extra fields for Vertification Date, Current Date (for vertification date)   --->
  147. newdiv.innerHTML = newdiv.innerHTML +
  148. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  149. "<tr>" +
  150. "<td id='paddingformultitop'>" +
  151. "Verification Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;" +
  152. "</td>" +
  153. "<td class='vertificationmoveinmulti'>" +
  154. "<cfoutput query='serial'><input type='text' name='vertifidate_" + count + "' value='#verification_date#'>&nbsp;&nbsp;</cfoutput>" +
  155. "&nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;" +
  156. "<input type='checkbox' name='currentdatevert_" + count + "' onClick=vertifidate_" + count + ".value=fill_date()>" +
  157. "</td>" +
  158. "</tr>" +
  159. "</table>";
  160.  
  161. <!--- Adds Extra fields for Dept/Vendor Responsibility  --->
  162. newdiv.innerHTML = newdiv.innerHTML +
  163. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  164. "<tr>" +
  165. "<td class='red' id='paddingformultitop'>" +
  166. "Dept/Vendor Responsibility*:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"  +
  167. "<select name='deptvendor_" + count + "'>" +
  168. "<option value='' selected>Make A Selection</option>" +
  169. "<cfoutput query='getDeptVendor'>" +
  170. "<option value='#pk_deptVendor#'<cfif #pk_deptVendor# is #dept_responsibility#>selected</cfif>>#pk_deptVendor#</option>" +
  171. " </cfoutput>" +
  172. "</select>" +
  173. "</td>" +
  174. "</tr>" +
  175. "</table>";
  176.  
  177. <!--- Adds Extra fields for RMA Data Only  --->
  178. newdiv.innerHTML = newdiv.innerHTML +
  179. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  180. "<tr>" +
  181. "<td id='paddingformultitop'>" +
  182. "RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;" +
  183. "</td>" +
  184. "<td class='rmanmoveinmulti'>" +
  185. "( You may enter up to 500 characters. )"+
  186. "<br/>" +
  187. "<cfoutput query='serial'><textarea maxlength='500' onkeyup='return ismaxlength(this)' onkeydown='return ismaxlength(this)' rows='4' cols='60' name='rma_" + count + "' >#rma_data#</textarea></cfoutput> " +
  188. "</td>" +
  189. "</tr>" +
  190. "</table>" +
  191. "<input type='hidden' name='serialcount' value='" + count + "'>";
  192.  
  193. <!--- Adds Delete to every ticket  --->
  194. newdiv.innerHTML = newdiv.innerHTML +
  195. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  196. "<tr>" +
  197. "<td>" +
  198. "<input type='button' class='removeticket' value='Remove Serial &quot;"+count +"&quot;' onclick=\"removeElement(\'"+divIdName+"\')\"></a>" +
  199. "</td>" +
  200. "</td>" +
  201. "</tr>" +
  202. "</table><br>";
  203.  
  204.  document.getElementById(divName).appendChild(newdiv);
  205.  
  206. </script>

i was using this after i submitted my form to loop through it. it was used to submit the form fields and also show a print screen on what was previously entered.

Expand|Select|Wrap|Line Numbers
  1. <CFSET machineListLen = listLen(Form.serialcount)>
  2. <CFLOOP from="1" to="#machineListLen#" index="machineCount">
  3.  <CFSET serialnum       = "Form.serialnum_" & machineCount>
  4.  <CFSET modelno         = "Form.modelno_" & machineCount>
  5.  <CFSET producttype     = "Form.producttype_" & machineCount>
  6.  <CFSET softhardware    = "Form.softhardware_" & machineCount>
  7.  <CFSET resolution      = "Form.resolution_" & machineCount>
  8.  <CFSET resdate         = "Form.resdate_" & machineCount>
  9.  <CFSET resvertified    = "Form.resvertified_" & machineCount>
  10.  <CFSET vertifidate     = "Form.vertifidate_" & machineCount>
  11.  <CFSET deptvendor      = "Form.deptvendor_" & machinecount>
  12.  <CFSET hardwarefailure = "Form.hardwarefailure_" & machineCount>
  13.  <CFSET rma             = "Form.rma_" & machineCount>
  14.  <CFSET thedescription  = "Form.thedescription_" & machineCount>
  15.  
  16. #evaluate(modelno)#....an so on.
but i am not sure if i can combine the above with what i have now because i am showing previously entered data an not entering the data.

Thank you for all the help,
Rach
Sep 22 '08
60 5288
acoder
16,027 Recognized Expert Moderator MVP
Yes, count will have to be set to 0 or 1 to begin with.
Sep 24 '08 #21
bonneylake
769 Contributor
Yes, count will have to be set to 0 or 1 to begin with.
Hey Acoder,

Ok with the count it keeps giving me the same number. Here is what i have

Expand|Select|Wrap|Line Numbers
  1. <cfset count = 1>
  2. <cfset count = count + 1>
It keeps giving me right now serial information 2, serial information 2, serial information 2. any ideas?

Thank you,
Rach
Sep 24 '08 #22
acoder
16,027 Recognized Expert Moderator MVP
The count needs to be incremented within the loop.
Sep 24 '08 #23
bonneylake
769 Contributor
The count needs to be incremented within the loop.
Hey Acoder,

Do i need to create its own loop for it? because here is what i have

Expand|Select|Wrap|Line Numbers
  1. <cfoutput query="serial">
  2.  
  3. <cfset model_no = #model_no#>
  4. <cfset product_type = #product_type#>
  5. <cfset type_hardware_failure = #type_hardware_failure#>
  6. <cfset software_hardware = #software_hardware#>
  7. <cfset resolution_verified_by = #resolution_verified_by#>
  8. <cfset dept_responsibility = #dept_responsibility#>
  9. <table class="zpExpandedTable" id="modeltable"> 
  10. <th class="sectiontitletick" colspan="7"><cfset count = 1>
  11. <cfset count = count + 1>
  12. Serial Information #count# </th>
  13. <tr>
  14. <td id="paddingformultitop">Model No:&nbsp;&nbsp;&nbsp;&nbsp;</td>
Thank you,
Rach
Sep 24 '08 #24
acoder
16,027 Recognized Expert Moderator MVP
The first cfset which sets the initial value should be outside the loop. The incrementing within the loop.
Sep 24 '08 #25
bonneylake
769 Contributor
The first cfset which sets the initial value should be outside the loop. The incrementing within the loop.
Hey Acoder,

Its counting correctly, but where do i put the
Expand|Select|Wrap|Line Numbers
  1. var count = <cfoutput>#count#</cfoutput>; 
part?

This is where i had put it, but it says Error resolving parameter COUNT

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.  <!---Allows us to add serial information multiple times --->
  3. function addInput(divName){
  4. var dynamic = document.getElementById('dynamicInput');
  5. var thevalue = document.getElementById('theValue');
  6. var count = (document.getElementById('theValue').value -1)+ 2;
  7. thevalue.value = count;
  8. var count = <cfoutput>#count#</cfoutput>;
  9. var newdiv = document.createElement('div');
  10. var divIdName = 'dynamic'+count+'Input';
  11. newdiv.setAttribute('id',divIdName);
Thank you,
Rach
Sep 24 '08 #26
acoder
16,027 Recognized Expert Moderator MVP
It'd have to be after the count has been set, so you could have a script that sets the count after the div, e.g.
Expand|Select|Wrap|Line Numbers
  1. </div>
  2. <script type="text/javascript">
  3. var count = <cfoutput>#count</cfoutput>;
  4. </script>
This is probably not best practice if you want to keep JavaScript code in the head in which case you can use cfhtmlhead.
Sep 24 '08 #27
bonneylake
769 Contributor
It'd have to be after the count has been set, so you could have a script that sets the count after the div, e.g.
Expand|Select|Wrap|Line Numbers
  1. </div>
  2. <script type="text/javascript">
  3. var count = <cfoutput>#count</cfoutput>;
  4. </script>
This is probably not best practice if you want to keep JavaScript code in the head in which case you can use cfhtmlhead.
Hey Acoder

it really aint working like it needs to doing it that way. What it does is if i have 2 serials. serial information 1 serial information 2. if i add another serial it changes the serial information 2 to a serial information 1. an if i add another it does this

serial information 1
serial information 1
serial information 2
serial information 2

its just not counting right, would adding into the javascript help? an what would i need to change to add it to the javascript?

Thank you,
Rach
Sep 24 '08 #28
acoder
16,027 Recognized Expert Moderator MVP
Can you show the current version of your code?
Sep 24 '08 #29
bonneylake
769 Contributor
Can you show the current version of your code?
Hey Acoder,

Ok here is the div part

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




an here is the javascript part

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.  
  3.  
  4.  <!---Allows us to add serial information multiple times --->
  5. function addInput(divName){
  6. var dynamic = document.getElementById('dynamicInput');
  7. var thevalue = document.getElementById('theValue');
  8. var count = (document.getElementById('theValue').value -1)+ 2;
  9. thevalue.value = count;
  10. var newdiv = document.createElement('div');
  11. var divIdName = 'dynamic'+count+'Input';
  12. newdiv.setAttribute('id',divIdName);
  13.  
  14. <!--- Adds Extra fields for Model No, Product Type, and Type of Hardware Failure  --->
  15. newdiv.innerHTML =
  16. "<table class='zpExpandedTable' id='modeltable'>" +
  17. "<th class='sectiontitletick' colspan='7'>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. "<cfoutput query='models'>" + 
  25. "<option value='#model#'>#model#</option>" + 
  26. "</cfoutput>" + 
  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. "<cfoutput query='getProdType'>" + 
  36. "<option value='#pk_productType#'>#pk_productType#</option>" + 
  37. "</cfoutput>" + 
  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. "<select name='hardwarefailure_" + count + "'>" +
  45. "<option value='' selected>Make A Selection</option>" +
  46. "<cfoutput query='getHardwareFail'>" +
  47. "<option value='#pk_hardwareFailure#'>#pk_hardwareFailure#</option>" +
  48. "</cfoutput>" +
  49. "</select>" +
  50. "</td>" +
  51. "</tr>" +
  52. "<table>";
  53.  
  54. <!--- Adds Extra fields for Serial Number and Software/Hardware  --->
  55. newdiv.innerHTML = newdiv.innerHTML +
  56. "<table class='zpExpandedTable' id='modeltable'>" +
  57. "<tr>" +
  58. "<td id='paddingformultitop'>" +
  59. "Serial Number:&nbsp;&nbsp;" +
  60. "<input type='text' name='serialnum_" + count + "'>" +
  61. "&nbsp;&nbsp;&nbsp;&nbsp;Software/Hardware:&nbsp;&nbsp;" +
  62. "<select name='softhardware_" + count + "'>" +
  63. "<option value='' selected>No Choice</option>" +
  64. "<cfoutput query='getSoftHard'>" + 
  65. "<option value='#pk_softwareHardware#'>#pk_softwareHardware#</option>" + 
  66. "</cfoutput>" + 
  67. "</select>" +
  68. "</td>" +
  69. "</tr>" +
  70. "</table>";
  71.  
  72. <!--- Adds Extra fields for Description  --->
  73. newdiv.innerHTML = newdiv.innerHTML + 
  74. "<table class='zpExpandedTable' id='resoltable' cellpadding='3' cellspacing='0'>" +
  75. "<tr>" +
  76. "<td id='paddingformutli'>" +
  77. "Description:&nbsp;&nbsp;" + 
  78. "</td>" +
  79. "<td class='descriptionmoveinmulti'>" +
  80. "( You may enter up to 500 characters. )"+
  81. "<br>" +
  82. "<textarea maxlength='500' onkeyup='return ismaxlength(this)' onkeydown='return ismaxlength(this)'rows='4' cols='60' name='thedescription_" + count + "'></textarea>" + 
  83. "</td>" +
  84. "</tr>" +
  85. "</table>";
  86.  
  87. <!--- Adds Extra fields for Resolution  --->
  88. newdiv.innerHTML = newdiv.innerHTML +
  89. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  90. "<tr>" +
  91. "<td id='paddingformutli'>" +
  92. "Resolution:&nbsp;&nbsp;" +
  93. "</td>" +
  94. "<td class='resolutionmoveinmulti'>" +
  95. "( You may enter up to 500 characters. )"+
  96. "<br>" +
  97. "<textarea  maxlength='500' onkeyup='return ismaxlength(this)' onkeydown='return ismaxlength(this)' rows='4' cols='60' name='resolution_" + count + "'></textarea>" +
  98. "</td>" +
  99. "</tr>" +
  100. "</table>";
  101.  
  102. <!--- Adds Extra fields for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by  --->
  103. newdiv.innerHTML = newdiv.innerHTML +
  104. "<table class='zpExpandedTable' id='resoldatetab' cellpadding='1' cellspacing='0'>" +
  105. "<tr>" +
  106. "<td id='paddingformultitop'>" +
  107. "Resolution Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;" +
  108. "</td>" +
  109. "<td>" +
  110. "<input type='text' name='resdate_" + count + "' value=''  >&nbsp;&nbsp;" +
  111.  
  112. "&nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;" +
  113. "<input type='checkbox' name='currentdateresol_" + count + "' onClick=resdate_" + count + ".value=fill_date()>" +
  114. "</td>" +
  115. "<td>" +
  116.  
  117. "Resolution Verified as effective by:&nbsp;&nbsp;"  +
  118. "</td>" +
  119. "<td>" +
  120. "<select name='resvertified_" + count + "'>" +
  121. "<option value='' selected>Make A Selection</option>" +
  122. "<cfoutput query='gettech'><option value='#fname# #lname#'>#fname# #lname#</option></cfoutput></select>" +
  123. "</td>" +
  124. "</tr>" +
  125. "</table>";
  126.  
  127. <!--- Adds Extra fields for Vertification Date, Current Date (for vertification date) and resolution vertified as effective by  --->
  128. newdiv.innerHTML = newdiv.innerHTML +
  129. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  130. "<tr>" +
  131. "<td id='paddingformultitop'>" +
  132. "Verification Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;" +
  133. "</td>" +
  134. "<td class='vertificationmoveinmulti'>" +
  135. "<input type='text' name='vertifidate_" + count + "'>&nbsp;&nbsp;" +
  136. "&nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;" +
  137. "<input type='checkbox' name='currentdatevert_" + count + "' onClick=vertifidate_" + count + ".value=fill_date()>" +
  138. "</td>" +
  139. "</tr>" +
  140. "</table>";
  141.  
  142. <!--- Adds Extra fields for Dept/Vendor Responsibility  --->
  143. newdiv.innerHTML = newdiv.innerHTML +
  144. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  145. "<tr>" +
  146. "<td class='red' id='paddingformultitop'>" +
  147. "Dept/Vendor Responsibility*:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"  +
  148. "<select name='deptvendor_" + count + "'>" +
  149. "<option value='' selected>Make A Selection</option>" +
  150. "<cfoutput query='getDeptVendor'>" +
  151. "<option value='#pk_deptVendor#'>#pk_deptVendor#</option>" +
  152. " </cfoutput>" +
  153. "</select>" +
  154. "</td>" +
  155. "</tr>" +
  156. "</table>";
  157.  
  158. <!--- Adds Extra fields for RMA Data Only  --->
  159. newdiv.innerHTML = newdiv.innerHTML +
  160. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  161. "<tr>" +
  162. "<td id='paddingformultitop'>" +
  163. "RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;" +
  164. "</td>" +
  165. "<td class='rmanmoveinmulti'>" +
  166. "( You may enter up to 500 characters. )"+
  167. "<br/>" +
  168. "<textarea maxlength='500' onkeyup='return ismaxlength(this)' onkeydown='return ismaxlength(this)' rows='4' cols='60' name='rma_" + count + "'></textarea> " +
  169. "</td>" +
  170. "</tr>" +
  171. "</table>" +
  172. "<input type='hidden' name='serialcount' value='" + count + "'>";
  173.  
  174. <!--- Adds Delete to every ticket  --->
  175. newdiv.innerHTML = newdiv.innerHTML +
  176. "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
  177. "<tr>" +
  178. "<td>" +
  179. "<input type='button' class='removeticket' value='Remove Serial &quot;"+count +"&quot;' onclick=\"removeElement(\'"+divIdName+"\')\"></a>" +
  180. "</td>" +
  181. "</td>" +
  182. "</tr>" +
  183. "</table>";
  184.  
  185. document.getElementById(divName).appendChild(newdiv);
  186.  
  187.  
  188. <!---Allows us to remove multiple fields --->
  189. function removeElement(divNum) {
  190.   var d = document.getElementById('dynamicInput');
  191.   var olddiv = document.getElementById(divNum);
  192.   d.removeChild(olddiv);
  193. }
  194.  
  195. </script>
Thank you,
Rach
Sep 24 '08 #30

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

Similar topics

0
2946
by: Charles Alexander | last post by:
Hello I am new to php & MySQL - I am trying to retrieve some records from a MySQL table and redisplay them. The data in list form looks like this: Sample_ID Marker_ID Variation G23_NA17192.fsa rs7374540 A/C I23_Control.fsa rs7374540 C/C
6
4798
by: Ravi | last post by:
Hi All, I am trying to execute a select statement using the DBI module of perl in a for loop. I am getting a strange behaviour, the select statement is excuting correctly only for the last element in the for loop. I am including the portion of the code : #Get the connection to the database my $dbh = &getConnection(); my @acodes;
43
5612
by: Gremlin | last post by:
If you are not familiar with the halting problem, I will not go into it in detail but it states that it is impossible to write a program that can tell if a loop is infinite or not. This is a fallacy built on the assumption of mythical infinite all powerfull machines. In reality we deal with finite machines that are capable of two states in a loop, they either terminate, or repeat themselves. In the mythical halting problem scenario...
11
2036
by: Roman Töngi | last post by:
for (int i = 1; i <= 10; i++) cout << i << endl; I expected the following: 1 2 3 4 5 6
2
2689
by: Alex | last post by:
Compiler - Borland C++ 5.6.4 for Win32 Copyright (c) 1993, 2002 Borland Linker - Turbo Incremental Link 5.65 Copyright (c) 1997-2002 Borland Platform - Win32 (XP) Quite by accident I stumbled across some wierd loop behavior. With the pasted code I receive the output that follows. I realize that the code is broken, because the inner loop fails to reset j for each iteration of the outer loop (the fix is commented out). I also know that...
63
3153
by: Aaron Ackerman | last post by:
What is the sytax for exiting a for loop in C#?
6
71985
by: John Pass | last post by:
What is the difference between a While and Do While/Loop repetition structure. If they is no difference (as it seems) why do both exist?
16
3555
by: Claudio Grondi | last post by:
Sometimes it is known in advance, that the time spent in a loop will be in order of minutes or even hours, so it makes sense to optimize each element in the loop to make it run faster. One of instructions which can sure be optimized away is the check for the break condition, at least within the time where it is known that the loop will not reach it. Any idea how to write such a loop? e.g.
2
19325
ADezii
by: ADezii | last post by:
If you are executing a code segment for a fixed number of iterations, always use a For...Next Loop instead of a Do...Loop, since it is significantly faster. Each pass through a Do...Loop that iterates a specified number of times, requires you to also implement or decrement some sort of Loop Counter, while a For...Next Loop does that work for you. Both Loops will provide the same results, but the For...Next Loop is substantially faster. One...
3
4489
by: numlock00 | last post by:
I have a nested 'while' loop that won't repeat, no matter how many times the outer loop repeats. The outer loop reads through an array of elements; the inner loop Ithe 'while' loop) is supposed to apply each of these elements while reading an input file. The outer loop is working fine. It will run through every element of the array. The inner loop, however, only runs once. Even though the outer loop finishes inormally, the inner loop does not...
0
9820
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10845
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10549
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10592
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9376
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5650
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5828
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4019
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3116
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.