PDA

View Full Version : Saving a number using Javascript



cup80
Apr 24th, 2007, 11:17 AM
Hi all,

I am creating a quoting tool, and in my first webpage I am able to calculate a cost. Now, when say for example the customer hits next, they are brought onto a new menu where they are asked further questions relating to the cost.

Now what I would like to be able to do is keep the cost from the first page, so any other new costs from the second page are added to it.

Is this possible? Is so can anyone help me?

Many thanks in advance

Cup:D

nikkiH
Apr 24th, 2007, 02:09 PM
Form submit would be passing that stuff along if it's in form elements.
If the cost isn't in a form element, put it in one (hidden) before the form actually submits.

Something like this, perhaps

<form onsubmit="this.YourHiddenElementName.value=getCost()" ...>

where getCost() is a function that returns the value you're wanting to save.

You could also just set the hidden element at the same time you calculate the cost, if you're doing that on another event already.