Hello,
Here is some sample code from my html page:
<script language="javascript" type="text/javascript">
function setProperties(formElement)
{
formElement.form.elements["customerID"].value=1;
alert(formElement.form.elements["customerID"].value);
}
</script>
<form name="myform" action="...">
<input type="hidden" name="customerID" id="customerID" value="xxx">
<input type="submit" id="loadform" name="loadform" onClick="setProperties(this);" value="Load form"></input>
<input type="submit" id="process" name="process" value="process"></input>
</form>
There are two submit buttons and I would like to change the hidden field value for one of the buttons when it is clicked. I have tried various ways to assign a value to the hidden field in the javascript but none of them works including the above.
I have tried "formElement.form.customerID.value", "formElement.form.getElementById("customerID"); etc but it does not work. Can someone please guide as to the right way of assigning the hidden field value in javascript. Thanks for your help.


Reply With Quote
Bookmarks