Expand|Select|Wrap|Line Numbers
- function chooseList(x)
- {
- alert(document.getElementById('myHiddenField').value);
- document.getElementById('myHiddenField').value=x;
- alert(document.getElementById('myHiddenField').value);
- document.getElementById('myForm').submit();
- }
In Firefox, the following happens, which is exactly what I intended to happen:
The function is called by onChange in a Select box and a new value is passed to the function.
1. The first alert shows the current value of the hidden field.
2. The value of the hidden field is changed to the new value, x.
3. The second alert shows the new value.
4. The form is submitted, passing along the new value.
In IE7, the following happens:
1. The first alert shows x, the new value of the hidden field, although the line of code which changes the value has not yet run!
2. The value is presumably changed now. ?
3. The second alert shows the new value, and is the same as the first alert.
4. The form is submitted, but no value is passed on for the hidden field!!!
The hidden field is:
Expand|Select|Wrap|Line Numbers
- <INPUT ID="myHiddenField" NAME="myFieldName" TYPE="Hidden" VALUE=1>
So there are two problems here. I would be grateful for any help in getting IE7 to behave when carrying out this function. Remember: it all works flawlessly in Firefox 3. Thank you!
BTW, the thread is showing spaces in the word 'value' in my function. These spaces are not in my code, not showing in the preview window and I cannot edit them out. (Sorry for not using code tags!)
Frank