Forms and HTML validation

Y

yandr

I am sure the answer is somewhere, but although I have searched for it I
couldn't find it.

I am doing form validation and I am checking each field using
document.FormName.FieldName.value
My problem is that I am using HTML 4 transitional and if I give a name to
the form (<form name="something">) it will not validate. I also can't use
document.Forms[0].FieldName because I have multiple forms in each page.
The ID tag doesn't seem to work either (I mean just replace 'name' with
'id').

So, the question is how can I access the form and validate at the same time?
It would be best if someone can direct me to a tutorial that included
cross-browser compatibility (supporting DOM3 and previous versions).

Thank you very much in advance and sorry if this is stupid.
 
M

Michael Winter

On Tue, 21 Sep 2004 10:09:53 GMT, Andrew Urquhart

[snip]
Use of ids for form referencing is not backwards compatible, but to get
a handle on the form:
document.getElementById("myFormId")

Though the forms collection works just as well except, as you say, with
old browsers. Then only named forms can be accessed.

[snip]

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top