Skip to content
View in the app

A better way to browse. Learn more.

Learn more

JavaScript and HTML Form Question - Figured out

Featured Replies









First Name:







Last Name:







Address:







Phone Number:







Email Address:







Pizza Size:



10


12


15




Payment Method:





Visa

American Express

Master Card

Cash





Choose your toppings:



Anchovies


Double Cheese


Pepperoni


Mushrooms




SubTotal:







PST:







GST:







Total:













One way to do it would be to remove the submit button, and replace it with a standard button which instead of submitting the form calls a function when clicked, the function can then calculate the total, enter the results into the total fields, and then submit the form.

 

 

 

Or you could have a function that is called every time the user changes any selections which updates the totals live.

 

 

 

I don't have time to write anything right now as I'm off to bed, so if nobody else has done it by tomorrow I will probably take a look.









First Name:







Last Name:







Address:







Phone Number:







Email Address:







Pizza Size:



10


12


15




Payment Method:





Visa

American Express

Master Card

Cash





Choose your toppings:



Anchovies


Double Cheese


Pepperoni


Mushrooms




SubTotal:







PST:







GST:







Total:













Create an account or sign in to comment

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.