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

Q1558 How I can change the action of a form depending on the completed text box?

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

Try:

<form onSubmit="
if (this.box1.value != '') this.action == 'box1.cgi';
else if (this.box2.value != '') this.action == 'box2.cgi';
else if (this.box3.value != '') this.action == 'box3.cgi';
else if (this.box4.value != '') this.action == 'box4.cgi';
else { alert('Please fill something in'); return false; }
return true;">
<input type="text" name="box1">
<input type="text" name="box2">
<input type="text" name="box3">
</form>

©2018 Martin Webb