473,836 Members | 1,543 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 5287
acoder
16,027 Recognized Expert Moderator MVP
Good work, though I'm not sure about the where clause. I think one of them is probably not needed.
Oct 13 '08 #61

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
4797
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
2035
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
19324
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
9818
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
10254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9374
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...
1
7791
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6979
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5649
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
5825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4016
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3113
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.