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!

Radio Buttons Sub Total Script

Status
Not open for further replies.

stretcher012599

Programmer
Nov 26, 2005
11
US
I have a form that has 10 radio buttons, each radio button represents a product. For each product, there is a different dollar value assocciated with each product. The form also has 3 text boxes, sub total, discount and total. The user will select 3 products from the list, and the product that is the lowest price will be the discount. Example: I check 3 products on the list, product 1 is $3.00 product 5 is $7.50 and proct 9 is $1.50 The sub total will be $12.00 and the discount will be $1.50 and the total will be $10.50

Can someone please show me an example on how I can do this without pressing the submit button. Thanks
 
You could use the onchange event... either add it manually onto each form element that could/should trigger your calculation code to update the form, or do it using javascript (maybe triggered on a class or something).

Either way, you trigger it run a function:
Code:
...
<input type="text" name="qty1" value="" [!]onchange="refreshForm()"[/!]/>
...
<input type="radio" name="opt1" value="Y" [!]onchange="refreshForm()"[/!]/>
...
You get the idea [smile]

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top