I’m trying to set the properties of a submit button in the onClick function I specify in the button tag descriptor, but none of the assignments are “working”, and the call to
document.form1.submit();
Seems to have no effect. The form submits whether I comment out the document.form1.submit(); call or not.
And the assignment doesn’t work either.
The alert works and displays the value passed in correctly.
What I want to do is to have default button text, (set by the “value=buttonText” param) but have it overridden in the onClick function so it gets passed into the query string.
Here’s the button descriptor:
<body>
<form name=”form1″ >
…
<INPUT TYPE=”SUBMIT” NAME=portname VALUE=DefaultBtnTxt onClick=submitTest(“<c: out value=”${easport.name}”/>”) >
…
</form>
</body>
Here’s the onClick function
<script type =”text/javascript”>
function submitTest(port)
{
alert(“submit! port: ” + port );
document.form1.portname.value=port;
alert(“submit!” + document.form1. );
document.form1.submit();
}
</script>
This seems like it’s right is is pretty much straight out of an example I have to work with from abook. (Visual Javascript 2nd Edition)
Any help or pointers is appreciated.
Ed