Hi,
I am trying to change and pass the value of a hidden input type on a
form tag to a cgi processing script based on the value of a checkbox
within the form:
function CheckBoxes () {
if (document.MyFor m.CheckBox1.che cked) {
document.MyForm .recipient.valu e = "2";
document.MyForm .submit();
}
}
...
<form name="MyForm" action="http://www.mycompany.c om/cgi/MailMyForm.pl"
method="post" onSubmit="retur n CheckBoxes()">
<input type="hidden" name="recipient " value="1">
<input name="CheckBox1 " type="checkbox" value="yes">
...
</form>
Obviously, this is a simplified version of the real example.
The "recipient" value of "1" is a default recipient's e-mail address in
case no checkboxes are selected. If (in this case) the checkbox
"CheckBox1" is checked, then "recipient" should get set to a value of
"2" which the cgi script will recognize as a different e-mail address
and process the form accordingly (it would just go to the e-mail
address defined in the cgi script for a "recipient" value of "2").
Any idea why this won't work? Is it that I cannot change the value of
"recipient" ?
Any help is appreciated.
I am trying to change and pass the value of a hidden input type on a
form tag to a cgi processing script based on the value of a checkbox
within the form:
function CheckBoxes () {
if (document.MyFor m.CheckBox1.che cked) {
document.MyForm .recipient.valu e = "2";
document.MyForm .submit();
}
}
...
<form name="MyForm" action="http://www.mycompany.c om/cgi/MailMyForm.pl"
method="post" onSubmit="retur n CheckBoxes()">
<input type="hidden" name="recipient " value="1">
<input name="CheckBox1 " type="checkbox" value="yes">
...
</form>
Obviously, this is a simplified version of the real example.
The "recipient" value of "1" is a default recipient's e-mail address in
case no checkboxes are selected. If (in this case) the checkbox
"CheckBox1" is checked, then "recipient" should get set to a value of
"2" which the cgi script will recognize as a different e-mail address
and process the form accordingly (it would just go to the e-mail
address defined in the cgi script for a "recipient" value of "2").
Any idea why this won't work? Is it that I cannot change the value of
"recipient" ?
Any help is appreciated.
Comment