Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | JavaScript | Form | Q1558 [ previous next ]

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

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.