S@m Posted June 7, 2006 Share Posted June 7, 2006 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 More sharing options...
scott100 Posted June 7, 2006 Share Posted June 7, 2006 I just tried it with the code you posted and it worked fine in IE & FF Link to comment Share on other sites More sharing options...
skym Posted June 7, 2006 Share Posted June 7, 2006 Are there other elements with the same AutoFeedbackForm name in the page? Link to comment Share on other sites More sharing options...
S@m Posted June 7, 2006 Author Share Posted June 7, 2006 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 More sharing options...
S@m Posted June 7, 2006 Author Share Posted June 7, 2006 Are there other elements with the same AutoFeedbackForm name in the page?<{POST_SNAPBACK}> 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 More sharing options...
scott100 Posted June 7, 2006 Share Posted June 7, 2006 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 More sharing options...
Little Goat Posted June 7, 2006 Share Posted June 7, 2006 <form action="pathHere" method="methodHere" name="AutoFeedbackForm" id="AutoFeedbackForm" /> <{POST_SNAPBACK}> 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 More sharing options...
S@m Posted June 7, 2006 Author Share Posted June 7, 2006 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 More sharing options...
scott100 Posted June 7, 2006 Share Posted June 7, 2006 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 ">".<{POST_SNAPBACK}> 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now