473,419 Members | 1,903 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

How to do a onchange event on text field that is part of a repeated region

I am trying to do an onchange event in a form using a text field. The form is tied to a record set that is part of a repeated region. One the first record when I edit the data it works perfectly. When I go to the second record nothing happens. I have attached the code below: I bolded text that contains the javascript and fields this is applied to
Expand|Select|Wrap|Line Numbers
  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
  2. <!--#include file="Connections/FutureOrders.asp" -->
  3. <!--#include file="Connections/DB2.asp" -->
  4. <%
  5. '*********************************
  6. '*  INSERT MULTIPLE RECORD
  7. '*  http://www.DwZone-it.com
  8. '*  Version 1.1.0
  9. '*********************************
  10. Dim dwzMultiple_1, editAction
  11. Set dwzMultiple_1 = New dwzMultipleRecord
  12. dwzMultiple_1.init
  13. dwzMultiple_1.setRedirectPage "Confirm1.asp"
  14. dwzMultiple_1.setConnection MM_FutureOrders_STRING
  15. dwzMultiple_1.setEditTable "FutOrdEdit"    
  16. dwzMultiple_1.setFormName "form1"
  17. dwzMultiple_1.setMultipleType "Insert"
  18. editAction = dwzMultiple_1.getEditAction()
  19. dwzMultiple_1.AddElement "Reason", "ReasonCode", "',none,''", "N"
  20. dwzMultiple_1.AddElement "PROGCD", "PROGCD", "',none,''", "N"
  21. dwzMultiple_1.AddElement "ORD2", "ORDERNUM", "',none,''", "N"
  22. dwzMultiple_1.AddElement "Initials", "NAME", "',none,''", "N"
  23. dwzMultiple_1.AddElement "ITEMNO", "ITEMNO", "',none,''", "N"
  24. dwzMultiple_1.AddElement "DATED", "DueDate", "',none,''", "N"
  25. dwzMultiple_1.AddElement "DESC", "DESCRIPTION", "',none,''", "N"
  26. dwzMultiple_1.AddElement "OVTERM", "OVTERM", "none,none,NULL", "N"
  27. dwzMultiple_1.AddElement "CUST", "XCUST", "',none,''", "N"
  28. dwzMultiple_1.AddElement "SHPDTE", "SDate", "',none,''", "N"
  29. dwzMultiple_1.AddElement "STDPCK", "STDPCK", "',none,''", "N"
  30. dwzMultiple_1.AddElement "ORDQTY", "OrdQty", "none,none,NULL", "N"
  31. dwzMultiple_1.AddElement "ORDQTY2", "RevOrdQty", "none,none,NULL", "N"
  32. dwzMultiple_1.AddElement "LNDISC", "LNDISC", "none,none,NULL", "N"
  33. dwzMultiple_1.AddElement "UNPRCE", "UNPRCE", "none,none,NULL", "N"
  34. dwzMultiple_1.AddElement "REVUNPRCE", "REVUNPRCE", "none,none,NULL", "N"
  35. dwzMultiple_1.execute()
  36. %>
  37. <%
  38.  
  39. Dim FO
  40. Dim FO_numRows,Details
  41. Details = Request.QueryString("00001")
  42.  
  43. Set FO = Server.CreateObject("ADODB.Recordset")
  44. FO.ActiveConnection = MM_DB2_STRING
  45. FO.Source = "SELECT concat(xcust,char(order)),XCUST,ORDDTE,DATED,PROGDL,DATED,CHAR(ORDER) AS ORDER,1-1 AS LI,LINENUM,ITEMNO,DESC,SHPQTY,LNDISC,SHPDTE, UNPRCE,OVTERM,PROGCD,OVTERM,MEDCMF99.NAME,ADDR,CITY,STATE,ZIP,EXT,(UNPRCE/(1.0-(LNDISC*.01))) AS GPRICE, (UNPRCE*(1.0-(OVTERM*.01))) AS GPRIC,concat(Trim(char(stdpck)) ,spcdsc)as STDPCK,NETOHQTY,ONPOQTY,PODELDAT  FROM QS36F.ORDERFILE,MEDCMF99  WHERE concat(xcust,Char(ORDER)) = '0109430046252'  AND XCUST=CUSTNO"
  46. FO.CursorType = 0
  47. FO.CursorLocation = 2
  48. FO.LockType = 1
  49. FO.Open()
  50.  
  51. FO_numRows = 0
  52. %>
  53. <%
  54. Dim Repeat1__numRows
  55. Dim Repeat1__index
  56.  
  57. Repeat1__numRows = -1
  58. Repeat1__index = 0
  59. FO_numRows = FO_numRows + Repeat1__numRows
  60. %>
  61.  
  62. <html>
  63. <head>
  64. <title>Untitled Document</title>
  65. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  66. <style type="text/css">
  67. <!--
  68. .Hide {
  69.     visibility: hidden;
  70.     display: none;
  71. }
  72. -->
  73. </style>
  74. </head>
  75.  
  76. <body>
  77. <form name="form1" method="post" action="<%=editAction%>">
  78.   <table width="76%" border="1" align="center">
  79.     <tr> 
  80.       <td colspan="14" nowrap bgcolor="#000000"> <div align="left"><font color="#FFFFFF" size="2"><strong>FUTURE 
  81.           ORDER EDIT FORM</strong></font><font size="2"> <strong><font size="2"> 
  82.           <strong><font size="2"> </font></strong></font></strong></font><font size="2">&nbsp;</font></div>
  83.         <div align="center"></div>
  84.         <div align="center"></div>
  85.         <div align="center"></div>
  86.         <div align="center"></div>
  87.         <div align="center"></div>
  88.         <div align="center"></div>
  89.         <div align="center"></div>
  90.         <div align="center"></div>
  91.         <div align="center"></div>
  92.         <div align="center"></div></td>
  93.       <td nowrap bgcolor="#000000"><div align="center"><strong><font color="#FFFFFF" size="3"> 
  94.           <input name="button" type="button" onClick="history.go(-1)" value="BACK">
  95.           </font></strong></div></td>
  96.       <style>
  97. input {font-size:6pt}
  98. input {font-weight: 600}
  99. input {font-family: Arial, Helvetica, sans-serif}
  100. </style>
  101.     </tr>
  102.     <tr> 
  103.       <td colspan="15" bgcolor="#000000"><font size="2"><strong><font color="#FFFFFF">CUST#</font></strong></font> 
  104.         <font color="#CCCCCC" size="2"><strong><font color="#FFFF00"><%=(FO.Fields.Item("XCUST").Value)%></font>&nbsp;</strong></font><font size="2"><strong><font color="#FFFFFF">NAME&nbsp;</font></strong><font color="#CCCCCC"><strong><font color="#FFFF00"><%=(FO.Fields.Item("NAME").Value)%></font>&nbsp;<font color="#FFFFFF">ADDRESS&nbsp;</font>&nbsp;<font color="#FFFF00"><%=(FO.Fields.Item("ADDR").Value)%></font><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"> 
  105.         </font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></font> 
  106.         <div align="center"><font color="#FF0000" size="2"> </font></div></td>
  107.     </tr>
  108.     <% 
  109.   Repeat1__index=Repeat1__index+1
  110.   Repeat1__numRows=Repeat1__numRows-1
  111.  
  112.  
  113. %>
  114. <script type="text/javascript">
  115. function upperCase(x)
  116.  
  117. {
  118. var y=document.getElementById(x).value (this.id) = ((1.0-(request.Form("revunprce")*.001)))
  119. document.getElementById(x).value=y
  120.  
  121. }
  122. function docopycat(x)
  123.  
  124. {
  125. var y=document.getElementById(x).value
  126.  
  127. document.getElementById("UNPRCE3").value  = (<%= FormatNumber((FO.Fields.Item("GPRICE").Value), 2, -2, -2, -2)  %>)- y
  128.  
  129.  
  130. }
  131. </script>
  132.     <tr> 
  133.       <td colspan="15" bgcolor="#000000"> <div align="left"><font size="2"><strong><font color="#CCCCCC"><strong><font color="#FFFFFF">CITY</font>&nbsp;<font color="#FFFF00"><%=(FO.Fields.Item("CITY").Value)%></font>&nbsp;</strong></font><font color="#FFFFFF">STATE&nbsp;&nbsp;</font><font color="#CCCCCC"><strong><font color="#FFFF00"><strong><%=(FO.Fields.Item("STATE").Value)%></strong></font>&nbsp;<font color="#FFFFFF">ZIP</font>&nbsp;<font color="#FFFF00"><%=(FO.Fields.Item("ZIP").Value)%></font></strong></font>&nbsp;<font color="#FFFFFF">ORDER&nbsp;</font><font color="#FFFF00"> 
  134.           <%=(FO.Fields.Item("ORDER").Value)%>&nbsp;</font><strong><font color="#FFFFFF">PROGRAM&nbsp;<font color="#FFFF00"><%=(FO.Fields.Item("PROGCD").Value)%></font> </font></strong></strong></font></div></td>
  135.     </tr>
  136.     <tr> 
  137.       <td height="25" colspan="15" bgcolor="#000000"><font size="2"><font color="#FFFFFF"><strong>SHIP 
  138.         DATE&nbsp;</strong></font><font size="2"><font color="#CCCCCC"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><strong><font color="#FFFF00" size="2"> 
  139.         <%=(FO.Fields.Item("SHPDTE").Value)%> </font><font size="2"><font color="#FFFFFF"><strong>DATING 
  140.         DATE &nbsp;<font color="#FFFF00"><%=(FO.Fields.Item("DATED").Value)%></font><font size="2"><font size="2"><font color="#CCCCCC"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><strong><font size="2"><font color="#FFFFFF"><strong>&nbsp;TERMS DISCOUNT&nbsp;</strong></font></font></strong></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></font></font></strong></font><font size="2"><font color="#CCCCCC"><strong><font color="#FFFF00"><%= FormatNumber((FO.Fields.Item("ovterm").Value), 2, -2, -2, -2) %></font> </strong></font></font></font></strong></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></font></font></td>
  141.     </tr>
  142.     <tr> 
  143.       <td width="4%" nowrap> <div align="center"></div></td>
  144.       <td colspan="2" nowrap> <div align="center"></div></td>
  145.       <td width="9%" nowrap> <div align="center"><font color="#FFFFFF" size="2"> 
  146.           </font></div></td>
  147.       <td colspan="2" nowrap> <div align="center"><font color="#FF0000" size="2"> 
  148.           </font></div>
  149.         <div align="center"><font color="#FF0000" size="1"> </font></div>
  150.         <div align="center"></div></td>
  151.       <td colspan="2"><div align="center"></div></td>
  152.       <td colspan="2" nowrap> <div align="center"><font color="#FF0000">Request</font></div></td>
  153.       <td><div align="center"></div>
  154.         <font color="#FF0000">&nbsp;</font></td>
  155.       <td colspan="2"><div align="center"><font color="#FF0000">Request</font></div></td>
  156.       <td colspan="2"> <div align="center"></div></td>
  157.     </tr>
  158.     <tr> 
  159.       <td nowrap bgcolor="#000000"> <div align="center"><font color="#FFFFFF" size="2">Delete</font></div></td>
  160.       <td colspan="2" nowrap bgcolor="#000000"> <div align="center"><font color="#FFFFFF" size="2">Reason 
  161.           Code</font></div></td>
  162.       <td nowrap bgcolor="#000000"> <div align="center"><font color="#FFFFFF" size="2">Item</font></div></td>
  163.       <td colspan="3" nowrap bgcolor="#000000"> <div align="center"><font color="#FFFFFF" size="2">Description</font></div></td>
  164.       <td nowrap bgcolor="#000000"><div align="center"><font color="#FFFFFF" size="2">Pack</font> 
  165.         </div>
  166.         <div align="center"></div></td>
  167.       <td width="7%" nowrap bgcolor="#000000"> <div align="center"><font color="#FFFFFF" size="2">Ord 
  168.           Qty</font></div></td>
  169.       <td nowrap bgcolor="#000000"> <div align="center"><font color="#FFFFFF" size="2">Rev 
  170.           Qty</font></div></td>
  171.       <td width="5%" bgcolor="#000000"> <div align="center"><font color="#FFFFFF" size="2">Gross</font></div></td>
  172.       <td width="1%" bgcolor="#000000"> <div align="center"><font color="#FFFFFF" size="2">Disc</font></div></td>
  173.       <td width="1%" bgcolor="#000000"><font color="#FFFFFF" size="2">RevDisc</font></td>
  174.       <td nowrap bgcolor="#000000"> <div align="center"><font color="#FFFFFF" size="2">Net/</font><font color="#FFFFFF" size="2">Net</font></div></td>
  175.       <td nowrap bgcolor="#000000">
  176. <div align="center"><font color="#FFFFFF" size="2">O/V NET/NET</font></div></td>
  177.     </tr>
  178.     <% 
  179. While ((Repeat1__numRows <> 0) AND (NOT FO.EOF)) 
  180. %>
  181.     <tr> 
  182.       <td height="29" nowrap> <div align="center"><font size="1"> 
  183.           <select name="select">
  184.             <option value="0"></option>
  185.             <option value="-1">Del</option>
  186.           </select>
  187.           </font> </div></td>
  188.       <td colspan="2" nowrap> <div align="center"><font size="2"> 
  189.           <select name="Reason" id="select2">
  190.             <option value="0"></option>
  191.             <option value="Customer Cancel">Cust Cancel</option>
  192.             <option value="Salesman Cancel">Slsman Cancel</option>
  193.             <option value="Credit A/R">Credit A/R</option>
  194.             <option value="MFG Problems">MFG Problems</option>
  195.             <option value="Below Minimum D/S">Below Min D/S</option>
  196.             <option value="DP Cancel">DP Cancel</option>
  197.             <option value="Cancel/Reenter">Cancel/Reenter</option>
  198.             <option value="Duplicate Order">Duplicate Order</option>
  199.             <option value="Expediter/C/S Cleanup">Exp./C/S Cleanup</option>
  200.             <option value="Out For Season">Out For Season</option>
  201.             <option value="MFG Cannot Supply">MFG Can't Supply</option>
  202.             <option value="Discontinued">Discontinued</option>
  203.             <option value="Import">Import</option>
  204.             <option value="No Inventory">No Inventory</option>
  205.             <option value="Recall">Recall</option>
  206.           </select>
  207.           <font color="#CCCCCC"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"> 
  208.           </font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font> 
  209.           <font color="#CCCCCC"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><font color="#CCCCCC"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"> 
  210.           <input name="PROGCD" type="text" class="Hide" id="PROGCD" value="<%=(FO.Fields.Item("PROGCD").Value)%>" size="15" readonly="true">
  211.           <font color="#CCCCCC" class="Hide"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"> 
  212.           <input name="ORD2" type="text" id="ORD2" value="<%=(FO.Fields.Item("ORDER").Value)%>" size="10" readonly="true">
  213.           </font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font> 
  214.           </font></strong></font></strong></font></strong></font></strong></font></strong></font></font></strong></font></strong></font></strong></font></strong></font></strong></font> 
  215.           <font color="#CCCCCC"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><font color="#CCCCCC"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"> 
  216.           </font></strong></font></strong></font></strong></font></strong></font></strong></font></font></strong></font></strong></font></strong></font></strong></font></strong></font> 
  217.           </font></div></td>
  218.       <td nowrap> <div align="center"><font size="2"> <strong class="Hide"><font size="2"><strong><font size="2"> 
  219.           <input name="Initials" type="text" class="headerbody" value="<%Response.Write Session ("UserName")%>" size="1" readonly="true">
  220.           </font></strong></font></strong> 
  221.           <input name="ITEMNO" type="text" value="<%=(FO.Fields.Item("ITEMNO").Value)%>" size="14" readonly="true">
  222.           <strong><font size="2"> 
  223.           <input name="DATED" type="text" class="Hide" id="DATED22" value="<%=(FO.Fields.Item("DATED").Value)%>" size="1" readonly="true">
  224.           </font></strong> </font></div></td>
  225.       <td colspan="3" nowrap> <div align="center"><font color="#FF0000" size="1"> 
  226.           </font><font size="2"> </font><font color="#FFFFFF" size="2"> </font><font color="#FF0000" size="1"> 
  227.           </font></div>
  228.         <div align="center"><font color="#FF0000" size="1"> </font><font size="2"><font color="#CCCCCC"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><font color="#CCCCCC"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"> 
  229.           <input name="PROGCD2" type="text" class="Hide" id="PROGCD22" value="<%=(FO.Fields.Item("PROGCD").Value)%>" size="1" readonly="true">
  230.           </font></strong></font></strong></font></strong></font></strong></font></strong></font></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></font><font color="#FF0000" size="1"> 
  231.           <input name="DESC" type="text" id="DESC5" value="<%=(FO.Fields.Item("DESC").Value)%>" size="20" readonly="true">
  232.           </font><font size="2"><font color="#CCCCCC"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"> 
  233.           </font><font color="#FFFFFF" size="2"> 
  234.           <input name="OVTERM" type="text" class="Hide" value="<%= FormatNumber((FO.Fields.Item("OVTERM").Value), 2, -2, -2, -2) %>" size="1" readonly="true">
  235.           </font><font size="2"> 
  236.           <input name="CUST" type="text" class="Hide" id="CUST" value="<%=(FO.Fields.Item("XCUST").Value)%>" size="1" readonly="true">
  237.           <font color="#CCCCCC"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><font color="#CCCCCC"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"><strong><font size="2"> 
  238.           <input name="SHPDTE" type="text" class="Hide" id="SHPDTE4" value="<%=(FO.Fields.Item("SHPDTE").Value)%>" size="1" readonly="true">
  239.           </font></strong></font></strong></font></strong></font></strong></font></strong></font></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font> 
  240.           </font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></font><font color="#FF0000" size="1"> 
  241.           </font><font color="#FF0000" size="2"> </font></div>
  242.         <div align="center"><font color="#FF0000" size="2"> </font></div>
  243.         <div align="center"><font size="2"> <strong><font color="#FF0000" size="2"> 
  244.           </font><font size="2"><strong><font color="#FF0000" size="2"> </font></strong></font></strong> 
  245.           </font><font color="#FF0000" size="2"> </font></div></td>
  246.       <td width="2%" nowrap bordercolor="#999999"> <div align="center"><font color="#FF0000" size="2"> 
  247.           <input name="STDPCK" type="text" value="<%=(FO.Fields.Item("STDPCK").Value)%>" size="5" readonly="true">
  248.           </font></div></td>
  249.       <td nowrap bordercolor="#999999"> <div align="center"><font size="2"><strong><font color="#FF0000" size="2"> 
  250.           </font><font size="2"><strong><font size="2"> </font></strong></font><font color="#FF0000" size="2"> 
  251.           </font><font size="2"><strong><font color="#FF0000" size="2"> </font></strong></font><font size="2"><strong><font size="2"> 
  252.           </font></strong></font><font size="2"> </font><font color="#FF0000" size="2"> 
  253.           <input name="ORDQTY" type="text" id="ORDQTY4" value="<%=(FO.Fields.Item("SHPQTY").Value)%>" size="4" readonly="true">
  254.           </font></strong> </font></div></td>
  255.       <td nowrap bordercolor="#FF0000" bgcolor="#CCCCCC"><div align="center"><font color="#FF0000" size="2"> 
  256.           <input name="ORDQTY2" type="text" id="ORDQTY24" size="4">
  257.           </font></div></td>
  258.       <td nowrap bordercolor="#999999"> <div align="center"><strong><font size="2"> 
  259.           </font><font size="2">
  260.           <input name="GPRICE2" type="text" value="<%= FormatNumber((FO.Fields.Item("GPRICE").Value), 2, -2, -2, -2) %>" size="8" readonly="true">
  261.           </font><font color="#FF0000" size="2"> </font></strong></div></td>
  262.       <td nowrap bordercolor="#999999"> <div align="center"><strong><font size="2"> 
  263.           </font><font size="2"> </font><font size="2"><strong><font size="2"> 
  264.           </font></strong></font><font size="2"><strong><font size="2"><strong><font color="#FF0000" size="2"> 
  265.           <input name="LNDISC" type="text" class="Hide" id="LNDISC4" value="<%= FormatNumber((FO.Fields.Item("LNDISC").Value), 2, -2, -2, -2) %>" size="4" readonly="true">
  266.           </font></strong></font></strong></font><font color="#FF0000" size="2"> 
  267.           </font></strong><font size="2"><strong><font color="#FF0000" size="2">
  268.           <input name="UNPRCE2" type="text" id="UNPRCE" value="<%= FormatNumber((FO.Fields.Item("LNDISC").Value), 2, -2, -2, -2) %>" size="4" readonly="true">
  269.           </font></strong></font></div></td>
  270.       <td nowrap bordercolor="#FF0000" bgcolor="#CCCCCC"><div align="center"><font size="2"><strong><font size="2"><strong><font color="#FF0000" size="2">
  271.         <input name="REVUNPRCE" type="text" id="REVUNPRCE3"
  272.         onChange='docopycat(this.id)' value="<%= FormatNumber((FO.Fields.Item("LI").Value), 2, -2, -2, -2) %>"  size="4">
  273.  
  274.  
  275.  
  276.  
  277.       </font></strong></font></strong></font></div></td>
  278.       <td width="3%" nowrap bordercolor="#999999"><div align="center"><font size="2"><strong><font color="#FF0000" size="2"> 
  279.         <input name="UNPRCE" type="text" id="UNPRCE2" value="<%= FormatNumber((FO.Fields.Item("GPRIC").Value), 2, -2, -2, -2) %>" size="4" readonly="true">
  280.         </font></strong></font><font color="#FFFFFF" size="2">&nbsp; <strong><font color="#FF0000"> 
  281.       </font></strong> </font> <font color="#FF0000" size="2"> </font></div></td>
  282.       <td width="18%" nowrap bordercolor="#FF0000" bgcolor="#CCCCCC"><div align="center"><font color="#FFFFFF" size="2"> 
  283.       </font><font size="2"><strong><font color="#FF0000" size="2"></font></strong></font><font size="2"><strong><font size="2"><strong><font color="#FF0000" size="2"></font><font size="2"><strong><font size="2"><strong><font color="#FF0000" size="2">
  284.       <input name="UNPRCE3" type="text" id="UNPRCE3"  size="4">  
  285.       </font></strong></font></strong></font></strong></font></strong></font></div></td>
  286.     </tr>
  287.     <% 
  288.  
  289.   Repeat1__index=Repeat1__index+1
  290.   Repeat1__numRows=Repeat1__numRows-1
  291.   FO.MoveNext()
  292.  
  293. Wend
  294. %>
  295.   </table>
  296.   <div align="center"> 
  297.     <input type="hidden" name="DW_insert" value="form1" />
  298.     <input type="submit" name="Submit" value="Request Order Change" />
  299.   </div>
  300. </form>
  301. <p>&nbsp;</p>
  302. </body>
  303. </html>
  304. <%
  305. FO.Close()
  306. Set FO = Nothing
  307. %>
  308. <!--#include file="dwzMultipleRecord/MultipleRecord.asp" -->
Oct 1 '09 #1
7 3101
jhardman
3,406 Expert 2GB
The problem is that all of these repeated items have the same name and ID. include an (x) in the name and ID, and also when you call the javascript function. Hope this helps.

Jared
Oct 1 '09 #2
Thank for the quick reply. I am very new to ASP, so I am a little confused by what you are saying. Could you please show me what you are referring to
Oct 2 '09 #3
jhardman
3,406 Expert 2GB
each control on the page needs to have a unique name and ID. So if they each have the same name, the javascript function will not be able to tell which box you are trying to update. Does that make sense?

so when you have this:
Expand|Select|Wrap|Line Numbers
  1.  <input name="REVUNPRCE" type="text" id="REVUNPRCE3"
  2.        onChange='docopycat(this.id)' value="<%= FormatNumber((FO.Fields.Item("LI").Value), 2, -2, -2, -2) %>"  size="4">
  3.  
notice that every repeat has the same name and ID. This is what is causing the problem. In order to sort it out, you will need to give the control an ID and Name that are different for each repeat, I usually do this like this:
Expand|Select|Wrap|Line Numbers
  1. for x = 1 to 25
  2.    '...
  3.    <input type="text" name="textbox<%=x%>">
  4.    '...
  5. next
Does that make sense? Now your loop is going through a db table, so the most logical solution would be some field from the db like an ID number. that way each row in the db is referenced in a single line in the web page made from this asp page.

Jared
Oct 5 '09 #4
I understand exactly what you are saying, I am just not sure where to apply what you are saying. As stated earlier I am new to ASP, so I am working my way through different projects trying to get the hang of it. Could you please so me in the code I have provide where to apply the loop
Oct 5 '09 #5
jhardman
3,406 Expert 2GB
OK, first, you have a loop in place. Everywhere from "while" to "wend" is a loop, this is the repeated part of your page. There are several ways to make a loop, your "while...wend" is one of them, you could probably acheive the same results with "for each ... next" or "for x = 1 to 100... next" or "do... loop". You could probably get similar results from each of these. I tend to use "do ... loop"s in this case, it's easy to say "do until fo.eof ... loop" (keeping looping until you get to the end of the table), but since that part is working, I suggest you don't break it. The one part I would change is in the "select" statement, the db query. You say
Expand|Select|Wrap|Line Numbers
  1. SELECT concat(xcust,char(order)),XCUST,ORDDTE,DATED,PROGDL,DATED,CHAR(ORDER) AS ORDER,1-1 AS LI,LINENUM,ITEMNO,DESC,SHPQTY,LNDISC,SHPDTE, UNPRCE,OVTERM,PROGCD,OVTERM,MEDCMF99.NAME,ADDR,CITY,STATE,ZIP,EXT,(UNPRCE/(1.0-(LNDISC*.01))) AS GPRICE, (UNPRCE*(1.0-(OVTERM*.01))) AS GPRIC,concat(Trim(char(stdpck)) ,spcdsc)as STDPCK,NETOHQTY,ONPOQTY,PODELDAT  FROM QS36F.ORDERFILE,MEDCMF99  WHERE concat(xcust,Char(ORDER)) = '0109430046252'  AND XCUST=CUSTNO
  2.  
You didn't name this first field you are pulling up, and I think you should use it as an ID, so I would say this
Expand|Select|Wrap|Line Numbers
  1. SELECT concat(xcust,char(order)) as ID,...
That gives this first field a name that will be different for each row of the recordset. Then in the input, I would add this ID to the name of the input, so that each repeated input has its own name:
Expand|Select|Wrap|Line Numbers
  1.  <input name="REVUNPRCE_<%=FO("ID")%>" type="text" id="REVUNPRCE_<%=FO("ID")%>"
  2.          onChange='docopycat(this.id)' value="<%= FormatNumber(FO("LI"), 2, -2, -2, -2) %>"  size="4">
By the way, the shorthand FO("ID") is the same as writing FO.Fields.Items("ID").Value

Does this make sense?

Jared
Oct 5 '09 #6
I made the changes that you suggested. Without applying the loop the page works similar as before. If I have 2 rows of data and lets say I update the second row it is doing the onchange event of row 1. I am still not sure where to apply the loop.
Expand|Select|Wrap|Line Numbers
  1.  <input name="REVUNPRCE_<%=FO("ID")%>" type="text" id="REVUNPRCE_<%=FO("ID")%>" onChange="docopycat(this.id)" value="<%= FormatNumber((0.00),2,-2,-2,-2)%>" size="4">
  2.  
Would it be right after the code displayed above and if so, everytime I ran the page I received an error. And thank you for you patience in this matter.
Oct 6 '09 #7
jhardman
3,406 Expert 2GB
@kirkgilbert
I tried to tell you already, you already have a loop. Please stop going on about a loop. I'm sorry I mentioned it. I brought it up because I thought it would help you understand the code you already had.

The issue of the wrong row being affected is still basically the same issue. When you make the change you are still telling the javascript function to change the first row (so you will need to make it change the row you are on) or you are telling it to change a field that has the same name as a hundred other fields.

You need to
  1. make sure the fields all have different names (don't just look through the ASP code, open the HTML source code from your browser and scroll down through it, you will find it informative) and
  2. make sure the javascript function is trying to update the row you are on
I could try to work through your code and throw a code solution at you, but that wouldn't help you understand what is going on. In order to restore my faith in humanity, please try these two things above and see if you can see what is happening. Then if you have a question about how to fix it, I will be glad to help.

Jared
Oct 7 '09 #8

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

Similar topics

7
by: Eddy Scheire | last post by:
Hi all, I've got this listbox and this text field on an ASP page. Now I want the item I click on in the listbox to appear in the text field and I can't find the code nowhere for what seems to me...
2
by: Asit | last post by:
In JavaScripts checks for an onChange event against the value of the textbox at the time of the last onChange event. Since an onChange Event never fired after you changed the text first time ,...
1
by: Roy Adams | last post by:
Hi Group I'm trying to write from dynamically created hidden fields to a txt field in the onchange event handler within a select. basically the number for the for loop is generated by a field...
1
by: SimonFx | last post by:
Am I right in assuming that you can NOT set focus() back to a field in its onChange event? Is there another way - I have validation that I would like to set the focus back to the invalid field...
3
by: jab3 | last post by:
Hello. I"m new to this group, and to JavaScript in general, so please forgive me if I breach local etiquette. I'm trying to implement some client-side 'dynamic' validation on a form. I'm having...
1
by: seahorse298 | last post by:
I am using MS Access 2000 on a Windows XP machine. I have a list form, listing the number of companies a business is dealing with. I have a filter field on the form which is used to filter the...
2
by: William Cole | last post by:
Here is my issue I have two text fields (Field A, Field B). I want Field B to be updated when Field A is changed. The problem is Field A is being changed through JavaScript so an onChange event...
3
by: lowslyn | last post by:
hi, can someone please help me with javascript... i have this code that checks a text field when the user overrides the value to blank/space. if it is blank/space, i need to change the value...
7
by: TriAdmin | last post by:
I am working with a system that allow me to add custom fields but I can not add OnChange() language to the custom fields. So I want to have a function in the header that recognizes when fieldx is...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
1
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...
0
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,...
0
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...
0
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...

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.