Adding values from drop-down boxes together

B

BobV

Group:

I have a form on my website that I want visitors to be able to fill-in to
order my product. I have two drop-down boxes for them to make selections.
For each item in the drop-down box, I have specified a numeric value (the
cost of the item they select). At the bottom of the form, I want to add the
total values from the two drop-down boxes. How do I do I add the value from
the first drop-down box to the value of the second drop-down box and have
the total appear in a text box (or some other type of a box) at the bottom
of the form?

For example, the value selected in drop-down box number 1 is 325.00 and the
value selected in drop-down box number 2 is 9.95. How do I add the two
together and enter the result of 334.95 in a text box on my form? Do I use
VBA to make the summation? Or do I have to redo my webpage as a database
form? Is what I am trying to do possible?

Any help will be greatly appreciated.
BobV
 
S

Stefan B Rusynko

You use JavaScript
- not VBA
See http://irt.org/script/form.htm#6



| Group:
|
| I have a form on my website that I want visitors to be able to fill-in to
| order my product. I have two drop-down boxes for them to make selections.
| For each item in the drop-down box, I have specified a numeric value (the
| cost of the item they select). At the bottom of the form, I want to add the
| total values from the two drop-down boxes. How do I do I add the value from
| the first drop-down box to the value of the second drop-down box and have
| the total appear in a text box (or some other type of a box) at the bottom
| of the form?
|
| For example, the value selected in drop-down box number 1 is 325.00 and the
| value selected in drop-down box number 2 is 9.95. How do I add the two
| together and enter the result of 334.95 in a text box on my form? Do I use
| VBA to make the summation? Or do I have to redo my webpage as a database
| form? Is what I am trying to do possible?
|
| Any help will be greatly appreciated.
| BobV
|
|
|
 
P

p c

If you want the calculation on the form without submitting the form for
further processing you would use javascript. However, unless you are
good with Jscript coding and accounting of all the combinations of
triggers (onchange), you may end up calculation the wrong value.

For more control, you may want to submit the selection to an inermediate
form run on the server (E.G. asp page) which calculates the result based
on the submitted selections. And if confirmed, do what you want to with it.

When it comes to money, it pays to confirm.

...PC
 

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

Top