Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


Form Validation - Object not always displayed on page



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> JavaScript Forum
View previous topic :: View next topic  
Author Message
neilr



Joined: 29 Apr 2007
Posts: 1

PostPosted: Sun Apr 29, 2007 9:06 pm    Post subject: Form Validation - Object not always displayed on page Reply with quote

I have an ASP web page which is used to logon to a database, when you are not logged on the web page only displays the Username and Password text boxes. Once logged on neither of these text boxes are displayed. I want the Username text box to recieve focus when the page loads which I can do but after you logon my function still tries to give the Username text box focus even though it does not exist which results in the following error -

Error: 'document.logon.username' is null or not an object
Code: 0

Any help would be greatly appreciated.

Many thanks

neilr
Back to top
View user's profile Send private message
mwa103
100+ Club


Joined: 07 Mar 2005
Posts: 206

PostPosted: Mon Apr 30, 2007 8:34 pm    Post subject: Re: Form Validation - Object not always displayed on page Reply with quote

The sloppy way to do it, in my opinion, would be to create an input box named username and make it hidden (input type='hidden') on a successful login. Not sure if you would get an error trying to give focus to a hidden element or not though. The better way to do it would be to code the program so that the focus is skipped somehow, but I have no idea how to tell you to do that. Maybe you could check to see if the object exists before giving it focus? (something like if(document.logon.username != null)) Hope this helps.

-Mike
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> JavaScript Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap