Field calcs with OnBlur

G

George

I am trying to have an auto calculation happen on a form when 1 of 2 boxes get data keyed into them. I tried using ONBLUR with both textboxes, but I kept getting an invalid object. I use VBscript for my coding.


<%
response.write(<td class=""detaill""><input type=""text"" name=""txtRate_1"" size=""5"" onBlur=""CalcTotal"" ></td>")


sub CalcTotal
..
..
..
end sub


%>

Any help would be appreciated.

Thanks,

George
 
A

Aaron [SQL Server MVP]

You will need to have CalcTotal in client-side script. ASP runs *once*,
returns HTML/client-side script to the client, and then doesn't exist. So
your client-side action can't magically call your server-side CalcTotal,
because it no longer exists. View the source, do you see it? Anything that
the client can do must be visible to the browser. ASP code is not visible
to the browser, it runs on the server and goes out of scope before the
browser displays a result that the end user can interact with.

--
http://www.aspfaq.com/
(Reverse address to reply.)




George said:
I am trying to have an auto calculation happen on a form when 1 of 2 boxes
get data keyed into them. I tried using ONBLUR with both textboxes, but I
kept getting an invalid object. I use VBscript for my coding.
 
R

Rob Collyer

I am trying to have an auto calculation happen on a form when 1 of 2
boxes get data keyed into them. I tried using ONBLUR with both
textboxes, but I kept getting an invalid object. I use VBscript for
my coding.


<%
response.write(<td class=""detaill""><input type=""text""
name=""txtRate_1"" size=""5"" onBlur=""CalcTotal"" ></td>")


sub CalcTotal
.
.
.
end sub


%>

Any help would be appreciated.

Thanks,

George

THe VBScript need to be CLIENT side.... it looks like the CalcTotal
function you are referring to resides in server side script.
 

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
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top