[Javascript] Form validation

Chris Tifer christ at saeweb.com
Tue Jan 20 08:48:03 CST 2004


First, what is "form"?

If that's the exact syntax you're using, I'd have to suggest that form is
not pointing to a form. If you have a name on your form (for instance
"myForm"), do this:

var objForm = document.forms["myForm"]

Then try

objForm.elements[arrFields[i]].focus()

form by itself is nothing...

If that still doesn't work, show us your exact code and I bet we can solve
it.

Chris Tifer

----- Original Message ----- 
From: "Cutter (JavaScript List)" <java.script at seacrets.com>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Tuesday, January 20, 2004 9:41 AM
Subject: Re: [Javascript] Form validation


> Chris,
>
> Thanks, but I'm still languishing here. I tried
>
> form.elements[arrFields[i]].focus();
> and
> form.elements[sName].focus();
>
> Both times it gave me the error "Error:'elements' is null or not an
> object". Any ideas? Anyone? Anyone?
>
> Cutter
>
> Chris Tifer wrote:
>
> >>form.array[i].focus();
> >>
> >>
> >--------------------------
> >As long as it's an input of some sort, you can always do:
> >
> >form.elements[array[i]].focus()
> >
> >Now I'm assuming array[i] just refers to to a string. Not to an actual
> >element. If it's an element, it'd probably error out.
> >
> >And I am also assuming that you did not name your array, array[].
Correct?
> >If so, call it something like arrFields or something else.
> >
> >
> >
> >_______________________________________________
> >Javascript mailing list
> >Javascript at LaTech.edu
> >https://lists.LaTech.edu/mailman/listinfo/javascript
> >
> >
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list