Safari/Chrome Not Posting Values When Changed Via Javascript
-
30-10-2019 - |
Question
I have a few hidden form elements like so:
<input type="hidden" name="numberOfAdults" />
I then have an onsubmit function that does some addition and puts the sum into the hidden fields:
form.numberOfAdults.value = numAdults;
The form is submitted depending on if this function returns true or false. When the form is submitted, IE7+ and Firefox show the changed value from the onsubmit function. Safari and Chrome do not. However, if I give the hidden inputs default values:
<input type="hidden" name="numberOfAdults" value="2" />
Then the value gets passed. Why are Safari and Chrome ignoring these changed values?
EDIT: Here is the complete code: http://jsfiddle.net/2q8SX/
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow