M
Matt Herson
I have been trying to find a way to use JavaScript to change the value of a
hidden field on submit. I am already invoking a JavaScript to handle the
validation on submit.
The reason I need to change this field is some of the forms have two buttons
on them, each needs to process the form differently. If I can change the
value of the hidden field dynamically it will solve my issue as I can run
each against a diffent cgi.
Currently my submit button looks like:
<a href="javascript:sendOrnot()"><img
src="../../../images/request_info_submit_submitImg.gif" border="0"></a>
I need one button to pass the value of:
<input type=hidden name=form-name value="request_for_info">
And the other as:
<input type=hidden name=form-name value="request_for_info_ver2">
I have tried using something like:
<form>
<input type="hidden" name="form-name" value="">
<input type="image" src="../../../images/request_info_submit_submitImg.gif"
onclick="this.form.form-name.value='request_for_info';this.form.sendOrnot()"
<input type="image"
src="../../../images/request_info_submit_ver2_submitImg.gif"onclick="this.fo
rm.form-name.value='request_for_info_ver2';this.form.this.form.sendOrnot()">
</form>
Doing so, gave me an invalid form error.
Any ideas on how I could accomplish this. I have done a lot of looking on
the web and have tried many things but have not had any luck. Any help would
be extremly appreciated. In addition to passing the changed value for
form-name, I also still need to invoke the JavaScript used for my
validation.
Thanks,
Matt
hidden field on submit. I am already invoking a JavaScript to handle the
validation on submit.
The reason I need to change this field is some of the forms have two buttons
on them, each needs to process the form differently. If I can change the
value of the hidden field dynamically it will solve my issue as I can run
each against a diffent cgi.
Currently my submit button looks like:
<a href="javascript:sendOrnot()"><img
src="../../../images/request_info_submit_submitImg.gif" border="0"></a>
I need one button to pass the value of:
<input type=hidden name=form-name value="request_for_info">
And the other as:
<input type=hidden name=form-name value="request_for_info_ver2">
I have tried using something like:
<form>
<input type="hidden" name="form-name" value="">
<input type="image" src="../../../images/request_info_submit_submitImg.gif"
onclick="this.form.form-name.value='request_for_info';this.form.sendOrnot()"
<input type="image"
src="../../../images/request_info_submit_ver2_submitImg.gif"onclick="this.fo
rm.form-name.value='request_for_info_ver2';this.form.this.form.sendOrnot()">
</form>
Doing so, gave me an invalid form error.
Any ideas on how I could accomplish this. I have done a lot of looking on
the web and have tried many things but have not had any luck. Any help would
be extremly appreciated. In addition to passing the changed value for
form-name, I also still need to invoke the JavaScript used for my
validation.
Thanks,
Matt