Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q374 Is it possible to nest a button inside a form and have this button execute a different cgi, passing the appropriate name/value pairs?

You are here: irt.org | FAQ | JavaScript | Form | 7.2 | Q374 [ previous next ]

Try:

<SCRIPT LANGUAGE="JavaScript"><!--
function mySubmit(myForm) {
    location.href = 'http://www.somewhere.com/someother.cgi?' +
                    'text1=' + escape(myForm.text1.value) +
                    '&' +
                    'text1=' + escape(myForm.text2.value);
}
//--></SCRIPT>

<FORM ACTION="http://www.somewhere.com/some.cgi">
<INPUT TYPE="TEXT" NAME="text1" VALUE="value1">
<INPUT TYPE="TEXT" NAME="text2" VALUE="value2">

<INPUT TYPE="BUTTON" VALUE="Submit Extra!" onClick="mySubmit(this.form)">

<INPUT TYPE="SUBMIT" VALUE="Submit">
</FORM>

©2018 Martin Webb