How to do a onchange event on text field that is part of a repeated region | Newbie | | Join Date: Oct 2009
Posts: 4
| |
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 -
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
-
<!--#include file="Connections/FutureOrders.asp" -->
-
<!--#include file="Connections/DB2.asp" -->
-
<%
-
'*********************************
-
'* INSERT MULTIPLE RECORD
-
'* http://www.DwZone-it.com
-
'* Version 1.1.0
-
'*********************************
-
Dim dwzMultiple_1, editAction
-
Set dwzMultiple_1 = New dwzMultipleRecord
-
dwzMultiple_1.init
-
dwzMultiple_1.setRedirectPage "Confirm1.asp"
-
dwzMultiple_1.setConnection MM_FutureOrders_STRING
-
dwzMultiple_1.setEditTable "FutOrdEdit"
-
dwzMultiple_1.setFormName "form1"
-
dwzMultiple_1.setMultipleType "Insert"
-
editAction = dwzMultiple_1.getEditAction()
-
dwzMultiple_1.AddElement "Reason", "ReasonCode", "',none,''", "N"
-
dwzMultiple_1.AddElement "PROGCD", "PROGCD", "',none,''", "N"
-
dwzMultiple_1.AddElement "ORD2", "ORDERNUM", "',none,''", "N"
-
dwzMultiple_1.AddElement "Initials", "NAME", "',none,''", "N"
-
dwzMultiple_1.AddElement "ITEMNO", "ITEMNO", "',none,''", "N"
-
dwzMultiple_1.AddElement "DATED", "DueDate", "',none,''", "N"
-
dwzMultiple_1.AddElement "DESC", "DESCRIPTION", "',none,''", "N"
-
dwzMultiple_1.AddElement "OVTERM", "OVTERM", "none,none,NULL", "N"
-
dwzMultiple_1.AddElement "CUST", "XCUST", "',none,''", "N"
-
dwzMultiple_1.AddElement "SHPDTE", "SDate", "',none,''", "N"
-
dwzMultiple_1.AddElement "STDPCK", "STDPCK", "',none,''", "N"
-
dwzMultiple_1.AddElement "ORDQTY", "OrdQty", "none,none,NULL", "N"
-
dwzMultiple_1.AddElement "ORDQTY2", "RevOrdQty", "none,none,NULL", "N"
-
dwzMultiple_1.AddElement "LNDISC", "LNDISC", "none,none,NULL", "N"
-
dwzMultiple_1.AddElement "UNPRCE", "UNPRCE", "none,none,NULL", "N"
-
dwzMultiple_1.AddElement "REVUNPRCE", "REVUNPRCE", "none,none,NULL", "N"
-
dwzMultiple_1.execute()
-
%>
-
<%
-
-
Dim FO
-
Dim FO_numRows,Details
-
Details = Request.QueryString("00001")
-
-
Set FO = Server.CreateObject("ADODB.Recordset")
-
FO.ActiveConnection = MM_DB2_STRING
-
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"
-
FO.CursorType = 0
-
FO.CursorLocation = 2
-
FO.LockType = 1
-
FO.Open()
-
-
FO_numRows = 0
-
%>
-
<%
-
Dim Repeat1__numRows
-
Dim Repeat1__index
-
-
Repeat1__numRows = -1
-
Repeat1__index = 0
-
FO_numRows = FO_numRows + Repeat1__numRows
-
%>
-
-
<html>
-
<head>
-
<title>Untitled Document</title>
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-
<style type="text/css">
-
<!--
-
.Hide {
-
visibility: hidden;
-
display: none;
-
}
-
-->
-
</style>
-
</head>
-
-
<body>
-
<form name="form1" method="post" action="<%=editAction%>">
-
<table width="76%" border="1" align="center">
-
<tr>
-
<td colspan="14" nowrap bgcolor="#000000"> <div align="left"><font color="#FFFFFF" size="2"><strong>FUTURE
-
ORDER EDIT FORM</strong></font><font size="2"> <strong><font size="2">
-
<strong><font size="2"> </font></strong></font></strong></font><font size="2"> </font></div>
-
<div align="center"></div>
-
<div align="center"></div>
-
<div align="center"></div>
-
<div align="center"></div>
-
<div align="center"></div>
-
<div align="center"></div>
-
<div align="center"></div>
-
<div align="center"></div>
-
<div align="center"></div>
-
<div align="center"></div></td>
-
<td nowrap bgcolor="#000000"><div align="center"><strong><font color="#FFFFFF" size="3">
-
<input name="button" type="button" onClick="history.go(-1)" value="BACK">
-
</font></strong></div></td>
-
<style>
-
input {font-size:6pt}
-
input {font-weight: 600}
-
input {font-family: Arial, Helvetica, sans-serif}
-
</style>
-
</tr>
-
<tr>
-
<td colspan="15" bgcolor="#000000"><font size="2"><strong><font color="#FFFFFF">CUST#</font></strong></font>
-
<font color="#CCCCCC" size="2"><strong><font color="#FFFF00"><%=(FO.Fields.Item("XCUST").Value)%></font> </strong></font><font size="2"><strong><font color="#FFFFFF">NAME </font></strong><font color="#CCCCCC"><strong><font color="#FFFF00"><%=(FO.Fields.Item("NAME").Value)%></font> <font color="#FFFFFF">ADDRESS </font> <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">
-
</font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></font>
-
<div align="center"><font color="#FF0000" size="2"> </font></div></td>
-
</tr>
-
<%
-
Repeat1__index=Repeat1__index+1
-
Repeat1__numRows=Repeat1__numRows-1
-
-
-
%>
- <script type="text/javascript">
-
function upperCase(x)
-
-
{
-
var y=document.getElementById(x).value (this.id) = ((1.0-(request.Form("revunprce")*.001)))
-
document.getElementById(x).value=y
-
-
}
-
function docopycat(x)
-
-
{
-
var y=document.getElementById(x).value
-
-
document.getElementById("UNPRCE3").value = (<%= FormatNumber((FO.Fields.Item("GPRICE").Value), 2, -2, -2, -2) %>)- y
-
-
-
}
-
</script>
-
<tr>
-
<td colspan="15" bgcolor="#000000"> <div align="left"><font size="2"><strong><font color="#CCCCCC"><strong><font color="#FFFFFF">CITY</font> <font color="#FFFF00"><%=(FO.Fields.Item("CITY").Value)%></font> </strong></font><font color="#FFFFFF">STATE </font><font color="#CCCCCC"><strong><font color="#FFFF00"><strong><%=(FO.Fields.Item("STATE").Value)%></strong></font> <font color="#FFFFFF">ZIP</font> <font color="#FFFF00"><%=(FO.Fields.Item("ZIP").Value)%></font></strong></font> <font color="#FFFFFF">ORDER </font><font color="#FFFF00">
-
<%=(FO.Fields.Item("ORDER").Value)%> </font><strong><font color="#FFFFFF">PROGRAM <font color="#FFFF00"><%=(FO.Fields.Item("PROGCD").Value)%></font> </font></strong></strong></font></div></td>
-
</tr>
-
<tr>
-
<td height="25" colspan="15" bgcolor="#000000"><font size="2"><font color="#FFFFFF"><strong>SHIP
-
DATE </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">
-
<%=(FO.Fields.Item("SHPDTE").Value)%> </font><font size="2"><font color="#FFFFFF"><strong>DATING
-
DATE <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> TERMS DISCOUNT </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>
-
</tr>
-
<tr>
-
<td width="4%" nowrap> <div align="center"></div></td>
-
<td colspan="2" nowrap> <div align="center"></div></td>
-
<td width="9%" nowrap> <div align="center"><font color="#FFFFFF" size="2">
-
</font></div></td>
-
<td colspan="2" nowrap> <div align="center"><font color="#FF0000" size="2">
-
</font></div>
-
<div align="center"><font color="#FF0000" size="1"> </font></div>
-
<div align="center"></div></td>
-
<td colspan="2"><div align="center"></div></td>
-
<td colspan="2" nowrap> <div align="center"><font color="#FF0000">Request</font></div></td>
-
<td><div align="center"></div>
-
<font color="#FF0000"> </font></td>
-
<td colspan="2"><div align="center"><font color="#FF0000">Request</font></div></td>
-
<td colspan="2"> <div align="center"></div></td>
-
</tr>
-
<tr>
-
<td nowrap bgcolor="#000000"> <div align="center"><font color="#FFFFFF" size="2">Delete</font></div></td>
-
<td colspan="2" nowrap bgcolor="#000000"> <div align="center"><font color="#FFFFFF" size="2">Reason
-
Code</font></div></td>
-
<td nowrap bgcolor="#000000"> <div align="center"><font color="#FFFFFF" size="2">Item</font></div></td>
-
<td colspan="3" nowrap bgcolor="#000000"> <div align="center"><font color="#FFFFFF" size="2">Description</font></div></td>
-
<td nowrap bgcolor="#000000"><div align="center"><font color="#FFFFFF" size="2">Pack</font>
-
</div>
-
<div align="center"></div></td>
-
<td width="7%" nowrap bgcolor="#000000"> <div align="center"><font color="#FFFFFF" size="2">Ord
-
Qty</font></div></td>
-
<td nowrap bgcolor="#000000"> <div align="center"><font color="#FFFFFF" size="2">Rev
-
Qty</font></div></td>
-
<td width="5%" bgcolor="#000000"> <div align="center"><font color="#FFFFFF" size="2">Gross</font></div></td>
-
<td width="1%" bgcolor="#000000"> <div align="center"><font color="#FFFFFF" size="2">Disc</font></div></td>
-
<td width="1%" bgcolor="#000000"><font color="#FFFFFF" size="2">RevDisc</font></td>
-
<td nowrap bgcolor="#000000"> <div align="center"><font color="#FFFFFF" size="2">Net/</font><font color="#FFFFFF" size="2">Net</font></div></td>
-
<td nowrap bgcolor="#000000">
-
<div align="center"><font color="#FFFFFF" size="2">O/V NET/NET</font></div></td>
-
</tr>
-
<%
-
While ((Repeat1__numRows <> 0) AND (NOT FO.EOF))
-
%>
-
<tr>
-
<td height="29" nowrap> <div align="center"><font size="1">
-
<select name="select">
-
<option value="0"></option>
-
<option value="-1">Del</option>
-
</select>
-
</font> </div></td>
-
<td colspan="2" nowrap> <div align="center"><font size="2">
-
<select name="Reason" id="select2">
-
<option value="0"></option>
-
<option value="Customer Cancel">Cust Cancel</option>
-
<option value="Salesman Cancel">Slsman Cancel</option>
-
<option value="Credit A/R">Credit A/R</option>
-
<option value="MFG Problems">MFG Problems</option>
-
<option value="Below Minimum D/S">Below Min D/S</option>
-
<option value="DP Cancel">DP Cancel</option>
-
<option value="Cancel/Reenter">Cancel/Reenter</option>
-
<option value="Duplicate Order">Duplicate Order</option>
-
<option value="Expediter/C/S Cleanup">Exp./C/S Cleanup</option>
-
<option value="Out For Season">Out For Season</option>
-
<option value="MFG Cannot Supply">MFG Can't Supply</option>
-
<option value="Discontinued">Discontinued</option>
-
<option value="Import">Import</option>
-
<option value="No Inventory">No Inventory</option>
-
<option value="Recall">Recall</option>
-
</select>
-
<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></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 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">
-
<input name="PROGCD" type="text" class="Hide" id="PROGCD" value="<%=(FO.Fields.Item("PROGCD").Value)%>" size="15" readonly="true">
-
<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">
-
<input name="ORD2" type="text" id="ORD2" value="<%=(FO.Fields.Item("ORDER").Value)%>" size="10" readonly="true">
-
</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></strong></font></strong></font></strong></font></strong></font></strong></font></font></strong></font></strong></font></strong></font></strong></font></strong></font>
-
<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">
-
</font></strong></font></strong></font></strong></font></strong></font></strong></font></font></strong></font></strong></font></strong></font></strong></font></strong></font>
-
</font></div></td>
-
<td nowrap> <div align="center"><font size="2"> <strong class="Hide"><font size="2"><strong><font size="2">
-
<input name="Initials" type="text" class="headerbody" value="<%Response.Write Session ("UserName")%>" size="1" readonly="true">
-
</font></strong></font></strong>
-
<input name="ITEMNO" type="text" value="<%=(FO.Fields.Item("ITEMNO").Value)%>" size="14" readonly="true">
-
<strong><font size="2">
-
<input name="DATED" type="text" class="Hide" id="DATED22" value="<%=(FO.Fields.Item("DATED").Value)%>" size="1" readonly="true">
-
</font></strong> </font></div></td>
-
<td colspan="3" nowrap> <div align="center"><font color="#FF0000" size="1">
-
</font><font size="2"> </font><font color="#FFFFFF" size="2"> </font><font color="#FF0000" size="1">
-
</font></div>
-
<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">
-
<input name="PROGCD2" type="text" class="Hide" id="PROGCD22" value="<%=(FO.Fields.Item("PROGCD").Value)%>" size="1" readonly="true">
-
</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">
-
<input name="DESC" type="text" id="DESC5" value="<%=(FO.Fields.Item("DESC").Value)%>" size="20" readonly="true">
-
</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">
-
</font><font color="#FFFFFF" size="2">
-
<input name="OVTERM" type="text" class="Hide" value="<%= FormatNumber((FO.Fields.Item("OVTERM").Value), 2, -2, -2, -2) %>" size="1" readonly="true">
-
</font><font size="2">
-
<input name="CUST" type="text" class="Hide" id="CUST" value="<%=(FO.Fields.Item("XCUST").Value)%>" size="1" readonly="true">
-
<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">
-
<input name="SHPDTE" type="text" class="Hide" id="SHPDTE4" value="<%=(FO.Fields.Item("SHPDTE").Value)%>" size="1" readonly="true">
-
</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></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></font><font color="#FF0000" size="1">
-
</font><font color="#FF0000" size="2"> </font></div>
-
<div align="center"><font color="#FF0000" size="2"> </font></div>
-
<div align="center"><font size="2"> <strong><font color="#FF0000" size="2">
-
</font><font size="2"><strong><font color="#FF0000" size="2"> </font></strong></font></strong>
-
</font><font color="#FF0000" size="2"> </font></div></td>
-
<td width="2%" nowrap bordercolor="#999999"> <div align="center"><font color="#FF0000" size="2">
-
<input name="STDPCK" type="text" value="<%=(FO.Fields.Item("STDPCK").Value)%>" size="5" readonly="true">
-
</font></div></td>
-
<td nowrap bordercolor="#999999"> <div align="center"><font size="2"><strong><font color="#FF0000" size="2">
-
</font><font size="2"><strong><font size="2"> </font></strong></font><font color="#FF0000" size="2">
-
</font><font size="2"><strong><font color="#FF0000" size="2"> </font></strong></font><font size="2"><strong><font size="2">
-
</font></strong></font><font size="2"> </font><font color="#FF0000" size="2">
-
<input name="ORDQTY" type="text" id="ORDQTY4" value="<%=(FO.Fields.Item("SHPQTY").Value)%>" size="4" readonly="true">
-
</font></strong> </font></div></td>
-
<td nowrap bordercolor="#FF0000" bgcolor="#CCCCCC"><div align="center"><font color="#FF0000" size="2">
-
<input name="ORDQTY2" type="text" id="ORDQTY24" size="4">
-
</font></div></td>
-
<td nowrap bordercolor="#999999"> <div align="center"><strong><font size="2">
-
</font><font size="2">
-
<input name="GPRICE2" type="text" value="<%= FormatNumber((FO.Fields.Item("GPRICE").Value), 2, -2, -2, -2) %>" size="8" readonly="true">
-
</font><font color="#FF0000" size="2"> </font></strong></div></td>
-
<td nowrap bordercolor="#999999"> <div align="center"><strong><font size="2">
-
</font><font size="2"> </font><font size="2"><strong><font size="2">
-
</font></strong></font><font size="2"><strong><font size="2"><strong><font color="#FF0000" size="2">
-
<input name="LNDISC" type="text" class="Hide" id="LNDISC4" value="<%= FormatNumber((FO.Fields.Item("LNDISC").Value), 2, -2, -2, -2) %>" size="4" readonly="true">
-
</font></strong></font></strong></font><font color="#FF0000" size="2">
-
</font></strong><font size="2"><strong><font color="#FF0000" size="2">
-
<input name="UNPRCE2" type="text" id="UNPRCE" value="<%= FormatNumber((FO.Fields.Item("LNDISC").Value), 2, -2, -2, -2) %>" size="4" readonly="true">
-
</font></strong></font></div></td>
-
<td nowrap bordercolor="#FF0000" bgcolor="#CCCCCC"><div align="center"><font size="2"><strong><font size="2"><strong><font color="#FF0000" size="2">
- <input name="REVUNPRCE" type="text" id="REVUNPRCE3"
-
onChange='docopycat(this.id)' value="<%= FormatNumber((FO.Fields.Item("LI").Value), 2, -2, -2, -2) %>" size="4">
-
-
-
-
-
</font></strong></font></strong></font></div></td>
-
<td width="3%" nowrap bordercolor="#999999"><div align="center"><font size="2"><strong><font color="#FF0000" size="2">
-
<input name="UNPRCE" type="text" id="UNPRCE2" value="<%= FormatNumber((FO.Fields.Item("GPRIC").Value), 2, -2, -2, -2) %>" size="4" readonly="true">
-
</font></strong></font><font color="#FFFFFF" size="2"> <strong><font color="#FF0000">
-
</font></strong> </font> <font color="#FF0000" size="2"> </font></div></td>
-
<td width="18%" nowrap bordercolor="#FF0000" bgcolor="#CCCCCC"><div align="center"><font color="#FFFFFF" size="2">
-
</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">
-
<input name="UNPRCE3" type="text" id="UNPRCE3" size="4">
-
</font></strong></font></strong></font></strong></font></strong></font></div></td>
-
</tr>
-
<%
-
-
Repeat1__index=Repeat1__index+1
-
Repeat1__numRows=Repeat1__numRows-1
-
FO.MoveNext()
-
-
Wend
-
%>
-
</table>
-
<div align="center">
-
<input type="hidden" name="DW_insert" value="form1" />
-
<input type="submit" name="Submit" value="Request Order Change" />
-
</div>
-
</form>
-
<p> </p>
-
</body>
-
</html>
-
<%
-
FO.Close()
-
Set FO = Nothing
-
%>
-
<!--#include file="dwzMultipleRecord/MultipleRecord.asp" -->
|  | Moderator | | Join Date: Jan 2007 Location: logan, utah
Posts: 2,690
| | | re: How to do a onchange event on text field that is part of a repeated region
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
| | Newbie | | Join Date: Oct 2009
Posts: 4
| | | re: How to do a onchange event on text field that is part of a repeated region
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
|  | Moderator | | Join Date: Jan 2007 Location: logan, utah
Posts: 2,690
| | | re: How to do a onchange event on text field that is part of a repeated region
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: - <input name="REVUNPRCE" type="text" id="REVUNPRCE3"
-
onChange='docopycat(this.id)' value="<%= FormatNumber((FO.Fields.Item("LI").Value), 2, -2, -2, -2) %>" size="4">
-
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: - for x = 1 to 25
-
'...
-
<input type="text" name="textbox<%=x%>">
-
'...
-
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
| | Newbie | | Join Date: Oct 2009
Posts: 4
| | | re: How to do a onchange event on text field that is part of a repeated region
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
|  | Moderator | | Join Date: Jan 2007 Location: logan, utah
Posts: 2,690
| | | re: How to do a onchange event on text field that is part of a repeated region
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 - 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
-
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 - 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: - <input name="REVUNPRCE_<%=FO("ID")%>" type="text" id="REVUNPRCE_<%=FO("ID")%>"
-
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
| | Newbie | | Join Date: Oct 2009
Posts: 4
| | | re: How to do a onchange event on text field that is part of a repeated region
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. -
<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">
-
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.
|  | Moderator | | Join Date: Jan 2007 Location: logan, utah
Posts: 2,690
| | | re: How to do a onchange event on text field that is part of a repeated region Quote:
Originally Posted by kirkgilbert 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. 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 - 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
- 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
|  | Similar ASP / Active Server Pages bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,510 network members.
|