M
Mangler
I am having trouble with a JavaScript Function that includes ASP in it.
The function almost works, I was wondering if someone can take a look
at it to see if the ASP in the function is the cause of the
malfunction.
There is a form where a user will input a number they are working on
and the onchange event of the field calls a function that will
auto-calculate what is already in the DB vs the number they are
updating it with.
For example: It there is 10 in the DB and the user wants to update
that with 5 more they will put in only the number 5 and the function
will add the recordset (10) to the number they input to give a result
of 15 in a hidden field. When the form is submitted the hidden field
updates the DB.
Here is the code:
<%While ((Repeat1__numRows <> 0) AND (NOT rsT.EOF)) %>
<% i=rsT.Fields.Item("idtrans").Value%>
function Add(<%=i%>)
{
var num1 = document.form2.bagqty<%=i%>.value;
var num2 = document.form2.hdntot<%=i%>.value ;
document.form2.hdnbagqty<%=i%>.value = parseFloat(num1) +
parseFloat(num2);
}
<%Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsT.MoveNext()
Wend%>
This works fine and gives something like this when the page is live:
function Add(16)
{
var num1 = document.form2.bagqty16.value;
var num2 = document.form2.hdntot16.value ;
document.form2.hdnbagqty16.value = parseFloat(num1) +
parseFloat(num2);
}
function Add(17)
{
var num1 = document.form2.bagqty17.value;
var num2 = document.form2.hdntot17.value ;
document.form2.hdnbagqty17.value = parseFloat(num1) +
parseFloat(num2);
}
But when a number is inputed in the bagqty field 2 errors are
happening:
Object expected
and
Expected identifier
I can explain more and give more code if need be. Does anyone see what
i may be doing wrong?
Respectfully,
Danny
The function almost works, I was wondering if someone can take a look
at it to see if the ASP in the function is the cause of the
malfunction.
There is a form where a user will input a number they are working on
and the onchange event of the field calls a function that will
auto-calculate what is already in the DB vs the number they are
updating it with.
For example: It there is 10 in the DB and the user wants to update
that with 5 more they will put in only the number 5 and the function
will add the recordset (10) to the number they input to give a result
of 15 in a hidden field. When the form is submitted the hidden field
updates the DB.
Here is the code:
<%While ((Repeat1__numRows <> 0) AND (NOT rsT.EOF)) %>
<% i=rsT.Fields.Item("idtrans").Value%>
function Add(<%=i%>)
{
var num1 = document.form2.bagqty<%=i%>.value;
var num2 = document.form2.hdntot<%=i%>.value ;
document.form2.hdnbagqty<%=i%>.value = parseFloat(num1) +
parseFloat(num2);
}
<%Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsT.MoveNext()
Wend%>
This works fine and gives something like this when the page is live:
function Add(16)
{
var num1 = document.form2.bagqty16.value;
var num2 = document.form2.hdntot16.value ;
document.form2.hdnbagqty16.value = parseFloat(num1) +
parseFloat(num2);
}
function Add(17)
{
var num1 = document.form2.bagqty17.value;
var num2 = document.form2.hdntot17.value ;
document.form2.hdnbagqty17.value = parseFloat(num1) +
parseFloat(num2);
}
But when a number is inputed in the bagqty field 2 errors are
happening:
Object expected
and
Expected identifier
I can explain more and give more code if need be. Does anyone see what
i may be doing wrong?
Respectfully,
Danny