Jump to content

form has no properties


S@m

Recommended Posts

I am trying to set focus to the first filed in my form.For some obvious reason, I can't get it to work.HTML

<body onload="document.AutoFeedbackForm.fname.focus();">

HTML

<form action="pathHere" method="methodHere" name="AutoFeedbackForm" id="AutoFeedbackForm" />

HTML

<input type="text" name="fname" id="fname" tabindex="6" title="Enter your first name" maxlength="150" value="" />

In my page, I have the actual path and method names in there.This is just for example.I get this error:document.AutoFeedbackForm has no properties...and I'm stuck.

Link to comment
Share on other sites

Really!?I mean, I thought it looked good to me too. It just doesn't work for me.In FF i get the above error, in IE I get this error:document.AutoFeedbackForm.fname is null or not an objectI also am calling in an external js file that uses window.onload to load a function.Would that be putting a kink in things?Thanks scott100 for your help.

Link to comment
Share on other sites

Are there other elements with the same AutoFeedbackForm name in the page?

No, I kept the names and ID's unique. Each unique txt input has the same name/ID though.example:HTML
<input type="text" name="fname" id="fname" tabindex="6" title="Enter your first name" maxlength="150" value="" />

and

<input type="text" name="lname" id="lname" tabindex="8" title="Enter your last name"  maxlength="150" value="" />

Link to comment
Share on other sites

I also am calling in an external js file that uses window.onload to load a function.Would that be putting a kink in things?
It could be... as i said when i copied the code you pasted everything worked ok, so that means there must be something else causing the problem which could be your external file.
Link to comment
Share on other sites

<form action="pathHere" method="methodHere" name="AutoFeedbackForm" id="AutoFeedbackForm" />

whoa.. form is not an empty element. change it to this:
<form action="pathHere" method="methodHere" name="AutoFeedbackForm" id="AutoFeedbackForm">....(your form elements here)</form>

Link to comment
Share on other sites

If I change it to that, the page doesn't validate.Line 124 column 7: end tag for "div" omitted, but OMITTAG NO was specified. </form>You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".

Link to comment
Share on other sites

If I change it to that, the page doesn't validate.Line 124 column 7: end tag for "div" omitted, but OMITTAG NO was specified. </form>You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".

There must be a problem before the </form> tag, the <form /> is definately not self closing, what about this div it talks about? have you forgotten to close it?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...