Hi
I have a form with the input fields:
ProductName
Quantity
and output fields:
ProductPrice
TotalUSD
Here's what I want it to do:
a) After either the ProductName or Quantity fields are updated by the user,
I want the resulting calculation to be displayed for the Product Price and
the TotalUSD. The ProductName is a drop-down with the product name as the
description and the value the dollar amount of each product.
b) I want the output fields to be displayed as $ format.
c) I want it so that the output fields can't be manually overwritten by the
user and later the form will be posted to a database.
I began with the following but are not familiar with the syntax of
JavaScript and got syntax errors. I also need the syntax for the AfterUpdate
event for the two input fields. Can you help?
I think I'll name the form "Form1".
<SCRIPT LANGUAGE="JavaS cript">
Function CalculateTotal( form) {
form.ProductPri ce.value=(form. ProductName.val ue);
form.TotalUSD.v alue= (form.ProductNa me.value * form.Quantity.v alue)
}
</SCRIPT>
I have a form with the input fields:
ProductName
Quantity
and output fields:
ProductPrice
TotalUSD
Here's what I want it to do:
a) After either the ProductName or Quantity fields are updated by the user,
I want the resulting calculation to be displayed for the Product Price and
the TotalUSD. The ProductName is a drop-down with the product name as the
description and the value the dollar amount of each product.
b) I want the output fields to be displayed as $ format.
c) I want it so that the output fields can't be manually overwritten by the
user and later the form will be posted to a database.
I began with the following but are not familiar with the syntax of
JavaScript and got syntax errors. I also need the syntax for the AfterUpdate
event for the two input fields. Can you help?
I think I'll name the form "Form1".
<SCRIPT LANGUAGE="JavaS cript">
Function CalculateTotal( form) {
form.ProductPri ce.value=(form. ProductName.val ue);
form.TotalUSD.v alue= (form.ProductNa me.value * form.Quantity.v alue)
}
</SCRIPT>
Comment