embed asp in html

J

JT

ok - here is my problem:

i have a page that dynamically displays payment info for accounts. since
each account differs in the number of rows to display, i loop through my
recordset and use the following asp embedded html:

<input type="text" style="TEXT-ALIGN: right"
value="<%=formatnumber(rsOldPaymentInfo.Fields("scheduled_amount"),2)%>"
name="<%=scheduled_amount_row%>" align="right" style="FONT-SIZE: xx-small;
width=50px">

i need to get a sum of these amounts and i am doing this for validation so i
need the values that are posted to the page, not the values retrieved from
the recordset.

so i know that i need to declare a variable that will record a tally of the
amounts posted: something like:

mySum = mySum + Response.Write("<input type="text" style="TEXT-ALIGN: right"
value="<%=formatnumber(rsOldPaymentInfo.Fields("scheduled_amount"),2)%>"
name="<%=scheduled_amount_row%>" align="right" style="FONT-SIZE: xx-small;
width=50px">")

--but i don't know how to get this tally correctly

any thoughts???


tia
jt
 
A

Adrienne

ok - here is my problem:

i have a page that dynamically displays payment info for accounts.
since each account differs in the number of rows to display, i loop
through my recordset and use the following asp embedded html:

<input type="text" style="TEXT-ALIGN: right"
value="<%=formatnumber(rsOldPaymentInfo.Fields("scheduled_amount"),2)%>"
name="<%=scheduled_amount_row%>" align="right" style="FONT-SIZE:
xx-small; width=50px">

i need to get a sum of these amounts and i am doing this for validation
so i need the values that are posted to the page, not the values
retrieved from the recordset.

so i know that i need to declare a variable that will record a tally of
the amounts posted: something like:

mySum = mySum + Response.Write("<input type="text" style="TEXT-ALIGN:
right"
value="<%=formatnumber(rsOldPaymentInfo.Fields("scheduled_amount"),2)%>"
name="<%=scheduled_amount_row%>" align="right" style="FONT-SIZE:
xx-small; width=50px">")

--but i don't know how to get this tally correctly

any thoughts???


tia
jt

mysum = mysum + rsOldPaymentInfo.Fields("scheduled_amount")
 
J

JT

but that would give me a sum based on what is returned from the db - i need
this for client side validation so i need to get the amount that the user
typed in, not the amount retrieved.

any other thoughts???
 
R

Robert May

Javascript.

First, you'll need to add the ID tag to your input boxes with the same value
as the name, and do something with the name and id that makes them
identifiable, as a box you want to sum like naming them
name="schedBox<%=scheduled_amount_row%>". You could also assign them a
specific CSS class (i.e. class="SUMBOX") and then search on their style
property, or you could just assume that all textboxes should be summed.
Then, you can put something like the following into your web page:

<SCRIPT language="javascript">
function CheckSum()
{
var oTextBoxes=document.getElementsByTagName("input");
var oTextBox;
var total;

for (i=0; i < oTextBoxes.length; i++)
{
oTextBox=oTextBoxes;
if (oTextBox.name.search("schedBox") != -1)
{
total+=oTextBox.value;
}
}
//Do something with the total
}
</SCRIPT>


Robert
JT said:
but that would give me a sum based on what is returned from the db - i need
this for client side validation so i need to get the amount that the user
typed in, not the amount retrieved.

any other thoughts???
 
J

Jeff Cochran

but that would give me a sum based on what is returned from the db - i need
this for client side validation so i need to get the amount that the user
typed in, not the amount retrieved.

Either check it client side, or if it has to be ASP use the exact same
method, only reading the data from the form input. For client side,
try a Javascript group.

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,126
Messages
2,570,750
Members
47,307
Latest member
Wimble

Latest Threads

Top