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

Q1145 Is there any way of validating a form on a page without using the name attribute in the form tag?

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

Q1145 Is there any way of validating a form on a page without using the name attribute in the form tag?

You can access forms using their position within the document forms array using their index:

document.forms[0]; // - first form in page 
document.forms[1]; // - second form in page 
document.forms[document.forms.length-1]; // - last form in page 

From a form field (but not the form tag itself) you can also use this.form to refer to the specific form object:

<form> 
<input type="button" onClick="functionName(this.form)"> 
</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.