Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form field mathematical calculation?

Status
Not open for further replies.

Kim42

Technical User
Aug 24, 2002
1
US
I have a very basic form and I want one of the form fields to do a mathematical calculation: (form field #1)* (form field #2) * (form field #3) and show the results in (form field #4). I don't see any options in formatting the form field that will do this. It seems like it should be such a simple thing ...
Thank you,
Kim
 
Kim42,
I am searching for the same results, and haven't found an answer, I will lett you know if i find the answer, If you could do the same.
Thanks
Costa
 
hi all,

ok if you are trying to do this, their are acouple of ways, the first way is to use java so that the calculations are worked out immediately...

However if oyu dont mind refreshing the page you can do the following

<html>
<head>
</head>
<body>
<%
dim field1, field2, field3, total
field1 = request.form(&quot;field1&quot;)
field2 = request.form(&quot;field2&quot;)
field3 = request.form(&quot;field3&quot;)
If field1 = &quot;&quot; or field2=&quot;&quot; or field3 = &quot;&quot; then
%>
<form method=&quot;post&quot; action=&quot;self.asp&quot;>
Please enter the three values<input type=&quot;text&quot; name=&quot;field1&quot;><input type=&quot;text&quot; name=&quot;field2&quot;>
<input type=&quot;text&quot; name=&quot;field3&quot;><input type=&quot;submit&quot; value=&quot;submit&quot; name=&quot;go&quot;>
</form>
<%
else
total = field1 * field2 * field3
%>
Here are the three values you entered<input type=&quot;text&quot; name=&quot;field1&quot; value=&quot;<% =field1 %>&quot;><input type=&quot;text&quot; name=&quot;field2&quot; value=&quot;<% =field2 %>&quot;>
<input type=&quot;text&quot; name=&quot;field3&quot; value=&quot;<% =field3 %>&quot;>
<%
end if
%>
<body>
</html>

Hope that is what you are looking for

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top