Back to Mal's forms page
Clicking on this logo will return you to our forms home page.

Please view our privacy page about cookies and how to remove them.

To view the code for any page, right click view source.

If you need help with any of these forms or, you find one not working correctly, please email me.


Here we have two variables, the number of people attending and the number of days they're attending. Obvioulsy we could do this using a standard form but it would mean a dropdown list for one of the two variables using productpr, and that can look messy; so we need some javascript to help us.

As you will see, I've made two forms, and used the 'nocart' attribute to keep the viewer on the same page, (ensure you have a link to the cart for the viewer). Each form has its own name 'form1', 'form2', these are important as the scripts read the correct form and use the correct values for making the calculation.

To keep everything nice and neat, I've used for the first form price1, rate1, etc, etc and for the second form, price2, rate2, etc, etc even though both forms are only one product. We need to do this or else if both forms use name=price and value=5.00 and name=price and value=1.00 then the scripts will not know which price to use.

In the first form, you will see id values such as fieldA and fieldB, these are the variables picked up by the script. You will also see an onblur instruction for each of these, plus one for the qty. I've added a box to confirm to the viewer how much their total is. And finally to bring it all together, in the form line we add an onsubmit instruction to tell the script to start working.

View your cart/checkout.

Number of adults @ £5.00 each:

Number of nights:

Total Calculated Price:

Number of children @ £1.00 each:

Number of nights:

Total Calculated Price: