Form calculations

W

Wylie C

I am building an order form in Frontpage 2000. I have text fields inserted
and named: Qty1, Doz1,Retail1,DozPrice1, and Total1

I want Total1 to calculate (Qty1*Retail1)+(Doz1*DozPrice1)

How can I do this?
 
J

John Cello

Wylie:

Try this:

<html>
<!--
Author: John Cello
Company: John Cello Consulting
URL: www.johncelloconsulting.com
E-Mail: [email protected]
Phone: (864) 224-6113
City & State: Anderson, SC
-->
<head>
<meta http-equiv="Content-Language" content="en-us">
</head>
<body>
<form action="--WEBBOT-SELF--" method="POST">
<!--webbot bot="SaveResults"
U-File="http://automation.intra.newsouth.com/_private/form_results.csv"
S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
<p>Qty1<input type="text" name="Qty1" size="20"></p>
<p>Doz1<input type="text" name="Doz1" size="20"></p>
<p>Retail1<input type="text" name="Retail1" size="20"></p>
<p>DozPrice1<input type="text" name="DozPrice1" size="20"></p>
<p>Total<input type="text" name="Total" size="20"></p>
<p><INPUT TYPE="BUTTON" VALUE="Try Me" onClick="this.form.Total.value =
((this.form.Qty1.value - 0) * (this.form.Retail1.value - 0) +
(this.form.Doz1.value - 0) * (this.form.DozPrice1.value - 0))"></p>
<p>&nbsp;</p>
</form>
</body>
</html>


Hope this helps

John Cello
www.johncelloconsulting.com
 
J

John Cello

My bad. Was doing client development when I answered your post and had some
of their code in in. Use this one:

<html>
<!--
Author: John Cello
Company: John Cello Consulting
URL: www.johncelloconsulting.com
E-Mail: [email protected]
Phone: (864) 224-6113
City & State: Anderson, SC
-->
<head>
<meta http-equiv="Content-Language" content="en-us">
</head>
<body>
<form action="--WEBBOT-SELF--" method="POST">
<!--webbot bot="SaveResults" U-File="../../_private/form_results.csv"
S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
<p>Qty1<input type="text" name="Qty1" size="20"></p>
<p>Doz1<input type="text" name="Doz1" size="20"></p>
<p>Retail1<input type="text" name="Retail1" size="20"></p>
<p>DozPrice1<input type="text" name="DozPrice1" size="20"></p>
<p>Total<input type="text" name="Total" size="20"></p>
<p><INPUT TYPE="BUTTON" VALUE="Try Me" onClick="this.form.Total.value =
((this.form.Qty1.value - 0) * (this.form.Retail1.value - 0) +
(this.form.Doz1.value - 0) * (this.form.DozPrice1.value - 0))"></p>
<p>&nbsp;</p>
</form>
</body>
</html>
 
W

Wylie C

Thanks John it works great. One more question tho..
Is there any way to set the total cell blank instead of zero if there are no
Qty1 or Doz1 values entered?

Thanks. What you gave me really helped me.
 
Top