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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculated field in form--how? 1

Status
Not open for further replies.

mickier

Programmer
Jul 5, 2001
17
US
This is not covered in HELP.

I have a form for making a reservation. 4 fields
[name]
[organization]
[numberoftickets]
[Price]

I want [price] to be auto-calculated based on [Numberoftickets] * $48.00.

I can't get this to work.
Any help appreciated.
Thanks!

Forms newbie..........
 
Code:
<script>
	function calcIt() {
		var costEach = 48.00;			

document.form1.price.value=document.form1.qty.value * costEach
}
</script>
<form name=&quot;form1&quot; action=&quot;&quot;>
	Qty: <select name=&quot;qty&quot; onchange=calcIt()>
				<option>Select Qty</option>
				<option value=&quot;1&quot;>1</option>
				<option value=&quot;2&quot;>2</option>
				<option value=&quot;3&quot;>3</option>
			</select><br>
	Total Price: $<input type=&quot;text&quot; name=&quot;price&quot; value=&quot;&quot;> <br>
</form>

This is in the simplest way possible. Hope it helps. This can be built on significantly.
DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top