it will work...
instead of using a submit button, make it a normal button and call
form.submit() at the end of the onClick handler
-----Original Message-----
From: George Smyth [mailto:george.smyth@U...]
Sent: 22 October 2001 16:57
To: javascript
Subject: [javascript] RE: Passing a Variable via Form
I tried this:
<input type="hidden" name="myText">
<input type="submit" name="Submit" value="Check Message" onClick="return
checkMessage(); document.form1.myText.value=text">
but it does not change the value of myText does not change. I also tried
giving myText a starting value, but the resulting value was not changed.
Cheers -
George L Smyth
-----Original Message-----
From: Alex Shiell, ITS, EC, SE [mailto:alex.shiell@s...]
Sent: Monday, October 22, 2001 10:56 AM
To: javascript
Subject: [javascript] RE: Passing a Variable via Form
you will need to do this the other way round - in your submit handler set
the value of the hidden field to equal the variable.
-----Original Message-----
From: George Smyth [mailto:george.smyth@U...]
Sent: 22 October 2001 15:34
To: javascript
Subject: [javascript] Passing a Variable via Form
Is it possible to pass a variable with a form?
For instance:
<script language="JavaScript">
var myVariable = "ABC"
</script>
<form ...
<input type="hidden" value={the value of the variable myVariable} ...
</form>
Thanks -
George L Smyth