Sign In  |  Register
 
 DotNetNuke Powered!
DotNetNuke Support Forums

Setting focus on a page

Rate this topic:

Please Register to post a reply.
Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.

AuthorMessages
jncraig
Posts:79



05/25/2007 6:43 PM  
I have the login module displayed on my home page for non-authenticated users.  I'd like the focus to be set to the login module so that the cursor goes into the Username box when the home page is displayed.

Any ideas?
John Mitchell
Posts:3248



05/26/2007 1:08 PM  
The Login module is already coded to do this. Do you maybe have something else on your home page that is interfering?
jncraig
Posts:79



05/26/2007 8:24 PM  
It's quite possible.  And it must be because the focus isn't going there.  I also notice that it's not filling in the "remembered" username and password as it does if you go to the conventional login page.

But there are no other date entry type boxes.

There are some Text/HTML modules, the Announcements module, a Survey module, a Google banner add ... and some invisible modules that hold Google Analytics stuff.

It's www.stockcentral.com if you want to take a look.
jncraig
Posts:79



05/29/2007 9:21 AM  
After doing some more fiddling, the login box works on a test 4.5.1 site but not on a similar 4.4.1 site ...
John Mitchell
Posts:3248



05/29/2007 9:24 AM  
I took a look, but haven't been able to figure out what was wrong on your stockcentral site yet.

You might try putting the login module on a page by itself and see if it works there.
jncraig
Posts:79



05/29/2007 1:14 PM  
Yeah, this is frustrating.

The is a setformfocus(controlname) for setting focus on a control at page load event. Is this possibly of some use to me?

(By the way, I set both of my experimental sites to use the default blue skin, and 4.5.1 works but 4.4.1 doesn't ...
John Mitchell
Posts:3248



05/29/2007 1:22 PM  
If you are not opposed to just hacking it in, then you could just add some javascript to the settings of the login module.

The id for yours is dnn_ctr824_Signin_txtUsername

So if you put this code in the footer section of the module settings it should work:
<scripttype="text/javascript">
   document.getElementById('dnn_ctr824_Signin_txtUsername').setFocus();
</script>
jncraig
Posts:79



05/29/2007 11:10 PM  
Thanks. I tried I added the javascript, cleared the cache, restarted the application ... and it doesn't work. :>(

And I looked at the page source and the code is there and the reference seems correct. Does that mean that something loaded after this login module is taking the focus?

What comes after (in the page's code) is:

1. a google ad banner using the banner module and google javascript to show the ads
2. a text/html module that contains a reference to another google script (for ad conversions or something)
3. a text/html module that contains some hyperlinks and no javascript
4. the footer panel with fairly standard copyright, terms and privacy controls
5. DNN Stuff's Google Analytics module -- that injects a javascript at the very bottom of the page.

Do you suggest removing any of this stuff?
jncraig
Posts:79



05/31/2007 8:08 PM  
For what it's worth, ugrading my site to DNN 4.5.3 seems to solve the problem. I can't yet do this on my main site for some other reasons, but it looks like the problem may go away when I can upgrade.

Also, I'm interested that 4.5.3 includes a vanishing behavior for the login box. I've put it on all of my pages, mainly because we have some teaser pages for the general public. Thanks to you, too, I've used some conditional code to turn off the "Login" link when the visitor isn't logged in.

Thanks for all of the help. (There is a lot to DNN that isn't available generally, so I really appreciate you and others who are publishing these great, meaty nuggets of information).
John Mitchell
Posts:3248



05/31/2007 9:02 PM  
Ok, sounds good. I wish I could have spent a little more time on this one, but I just couldn't get back to it.

Thanks for the positive feedback.
Please Register to post a reply.
Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.

Forums >DotNetNuke Support >General-DNN-Help > Setting focus on a page



ActiveForums 3.7
Visit our Store for great DotNetNuke Modules and Skins
DNNMasters Sitemap/Google Sitemap 3.0

Item codeSM3-01
Price$29.00
Product Information 
DotNetNuke CSS NavMenu 3.3 (Developers)

Item codeCSSNM33DEV
Base Price$149.00
Product Information 
Snapsis PageBlaster 3.3.2 for DotNetNuke - Professional Edition

AuthorJohn Mitchell
Base Price$79.00
Product Information 
XDAkuna (Web 2.0 CSS XHTML Skin)

Item codeXDAkuna
AuthorNina Meiers
Price$49.00
Product Information