I hope someone has come across this problem before.

On my page I have a hidden field
<input name="product_size_id" type="text" id="product_size_id" value=""/>

and when a user selects a product size from a selection box the following function is called:

//--><!--functions to hide and reveal stock level based on product_size selected and to refresh hidden product_size_id value -->
function revealContent(idParam,selObj) {
var string_array = selObj.options[selObj.selectedIndex].value.split("/");
var size_id = string_array[0];
var size = string_array[1];

document.getElementById('product_size_id').value=size_id;

if(document.getElementById(idParam + '/' + size).style.display == "none") {
for (var i=0; i<selObj.length; i++){
var string_array_in_loop = selObj.options[i].value.split("/");
var sizeInLoop = string_array_in_loop[1];
document.getElementById(idParam + '/' + sizeInLoop).style.display = "none";
}
document.getElementById(idParam + '/' + size).style.display = "";
}
}
//-->



However, the hidden field 'product_size_id' doesn't get it's value updated when the function is called.

The very strange thing is, if I change the type of the hidden field to text so the value is shown on screen then everything functions fine??

Thanks in advance.