Autofocus at the loginpage

All notes and input on 2.0 Development are herein. <ul><li>Feature requests</li>
<li>Bug Reports</li>
<li>Beta Testing Feedback</li>
<li>Open Dev Discussion</li></ul>

Moderator: Coranto Moderator Team

Autofocus at the loginpage

Postby Parahead » Sat Aug 30, 2003 3:44 pm

I have modified my copy of Coranto so that at the loginpage the inputfield for the username gets focus when entering Coranto. It is a small thing but it bugs me that I always have to tab or click at the field to gain focus when it is so simple to do it with a little Javascript...

In crcore.pl at the LoginPage-sub, add the following before the LoginPage_2-HOOK:

Code: Select all
    print qq~
    <script language="Javascript">
    <!--
    document.forms[0].uname.focus();
    -->
    </script>
    ~;



That is all,
/Parahead
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby kriko » Sat Aug 30, 2003 5:13 pm

some browsers, such as IE autofocus the first form input element on the page.
Kristjan aka. kriko
now a wireless expert
User avatar
kriko
 
Posts: 3328
Joined: Sat Feb 24, 2007 8:13 pm

Postby Parahead » Sat Aug 30, 2003 6:14 pm

I am using IE6 on Win2000 and the first inputfield is *not* autofocused. And even if it would, this little fix would make it work on all browsers, there is no harm in that I think... :wink:
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby kriko » Sat Aug 30, 2003 6:21 pm

well. dragon didn't really like having javascript in the core...
Kristjan aka. kriko
now a wireless expert
User avatar
kriko
 
Posts: 3328
Joined: Sat Feb 24, 2007 8:13 pm

Postby InSAnE NiNjA » Sat Aug 30, 2003 6:56 pm

only because of possible incompatability..

but this element would only be a bonus to anyone who was compatable, the rest would see default
..nuttier then a squirrel turd..
User avatar
InSAnE NiNjA
 
Posts: 1213
Joined: Sat Jan 25, 2003 6:35 am

Postby Parahead » Sat Aug 30, 2003 8:38 pm

Like NiNjA say, this functionality is just an extra bonus...

And if drgn is scared of incompatability maybe an if-statement should be added to be extra superduper sure we don´t get an Javascript-error:
Code: Select all
    <script language="Javascript">
    <!--
    if(document.forms[0].uname) {
      document.forms[0].uname.focus();
    }
    -->
    </script>
    ~;


Anyway, I use it in my installation regardless of it is in the core of not, just making suggestions you know... :wink:
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby Lawrence » Sat Aug 30, 2003 8:53 pm

I'll talk to dragn and see if we can put it in 1.30 :)
Stuff I'm working on:
- nothing

Addons:
http://sourceforge.net/projects/lw-craddons/
Lawrence
 
Posts: 1524
Joined: Sun Sep 16, 2001 4:24 am

Postby Parahead » Sat Aug 30, 2003 9:34 pm

8)
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby Lawrence » Sun Aug 31, 2003 11:25 pm

I don't think it'll be a big deal...

I knows a bit of JS and it's not hard to make it so that if something isn't supported, then don't use it :)
Stuff I'm working on:
- nothing

Addons:
http://sourceforge.net/projects/lw-craddons/
Lawrence
 
Posts: 1524
Joined: Sun Sep 16, 2001 4:24 am

Postby l0rdphi1 » Tue Sep 02, 2003 6:34 pm

Mozilla/NS index by field name. IE indexes by number.

You need an IF.
User avatar
l0rdphi1
 
Posts: 3590
Joined: Sat Mar 09, 2002 10:03 pm
Location: Pennsylvania, United States of America

Postby Lawrence » Wed Sep 03, 2003 4:19 pm

Thanks for the tidbit :)

My JS is a lil rusty ;)
Stuff I'm working on:
- nothing

Addons:
http://sourceforge.net/projects/lw-craddons/
Lawrence
 
Posts: 1524
Joined: Sun Sep 16, 2001 4:24 am

Postby l0rdphi1 » Wed Sep 03, 2003 6:03 pm

User avatar
l0rdphi1
 
Posts: 3590
Joined: Sat Mar 09, 2002 10:03 pm
Location: Pennsylvania, United States of America

Postby Parahead » Sun Sep 07, 2003 1:56 pm

l0rdphi1, you are right, the code I gave as example was not that good after all since it did not work with Netscape, it was some time ago I coded JS and one forget the pitfalls of JS very fast... ;-)

Anyway, I have made a check that I have personally tested in IE6, NS4.5 and Mozilla1.4 and it works in all of those...

The test looks like this and should be placed at the same place as before (crcore.pl at the LoginPage-sub, before the LoginPage_2-HOOK):
Code: Select all
    print qq~
    <script language="Javascript">
    <!--
    if(document.loginform.elements['uname'])
    {
      document.loginform.elements['uname'].focus();
    }
    //-->
    </script>
    ~;


This requires that the form-element a couple of lines above in crcore.pl is changed from:
Code: Select all
<form action="$scripturl" method="post"><br>

to include the name of the form as such:
Code: Select all
<form action="$scripturl" method="post" name="loginform"><br>
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby Parahead » Tue Oct 21, 2003 3:03 pm

As pointed out by LoneOwl elsewhere this little piece of Javascript-request should obviously not be placed in the core of Coranto, but instead in an addon.

So I would like to change this request to just be the following;

In crcore.pl at the LoginPage-sub, the line:
Code: Select all
<form action="$scripturl" method="post"><br>


should be modified to include a name of the form as well, as such:
Code: Select all
<form action="$scripturl" method="post" name="loginform"><br>
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby cerberos76_ » Tue Oct 21, 2003 3:56 pm

I agree that this features can and shouldbe introduced only optionally via addons.
I will add formname in the next version of the core.
Coranto addons:
* GuestPost, one click guestposting
* MoveIt!, Advanced Backup and site transfer
* PartialRebuild, CPU-friendly enhancement of FullBuild
* URLColumn, URLs for multiple Categories/Profiles
* Tickit!, Javascript News Tickers/Faders for Coranto!
* AddonEnabler, enables or disables single, multiple or all addons in one go
* SubmitMultiple, post consecutive news in an automatic loop!
* RSSAdvanced, RelatedNews ....

Get them at: http://coranto.gweilo.org/addons/
cerberos76_
 
Posts: 1339
Joined: Sun Mar 10, 2002 1:21 am

Next

Return to Coranto 2.0 Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron