[2.0.8] Form SetFocus MOD

The cleanup is complete. This forum is now read only.

Rating:

Excellent!
0
No votes
Very Good
3
43%
Good
0
No votes
Fair
1
14%
Poor
3
43%
 
Total votes: 7

AbelaJohnB
Former Team Member
Posts: 5674
Joined: Fri Jul 06, 2001 11:56 pm

[2.0.8] Form SetFocus MOD

Post by AbelaJohnB »

MOD Name: Form SetFocus MOD
Author: AbelaJohnB
MOD Description: This MOD will set your cursor to be auto-focused on most (but not all) forms within phpBB. Uses simple JavaScript.

MOD Version: 1.0.0


Download File: setfocus.mod
File Size: 7403 Bytes
Last edited by AbelaJohnB on Mon Apr 30, 2007 12:26 am, edited 2 times in total.
AbelaJohnB
Former Team Member
Posts: 5674
Joined: Fri Jul 06, 2001 11:56 pm

Post by AbelaJohnB »

MOD Validated/Released :mrgreen:
deny
Registered User
Posts: 565
Joined: Wed May 14, 2003 9:14 am
Contact:

phpBB 2.0.4

Post by deny »

Work this MOds with phpbb 2.0.4?
User avatar
romans1423
Registered User
Posts: 1560
Joined: Sat Nov 02, 2002 4:44 pm
Location: Connersville, IN
Name: Rick Beckman
Contact:

Post by romans1423 »

Won't this affect the BBCode JavaScript, which reference the posting form by the name "post", not "form" (which this MOD changes it to)??
RickBeckman.org | The Fellowship Hall – Diversity-friendly Religious Forums
AbelaJohnB
Former Team Member
Posts: 5674
Joined: Fri Jul 06, 2001 11:56 pm

Post by AbelaJohnB »

romans1423 wrote: Won't this affect the BBCode JavaScript, which reference the posting form by the name "post", not "form" (which this MOD changes it to)??



If you find that happening, I'd be interrested in knowing about it.
User avatar
romans1423
Registered User
Posts: 1560
Joined: Sat Nov 02, 2002 4:44 pm
Location: Connersville, IN
Name: Rick Beckman
Contact:

Post by romans1423 »

John,
Well, I solved the problem before I even tried to see if it was really a problem... I simply edited all the BBCode JS to reference the new form name instead of the old. :lol:

However, the JavaScript that you add to the overall_header results in an error on any page that doesn't have a modded form since the header JS references the forms which don't exist on every page... Minor problem yes, but I have removed the MOD until further notice.

I love the idea though!
RickBeckman.org | The Fellowship Hall – Diversity-friendly Religious Forums
User avatar
Daz
Registered User
Posts: 5236
Joined: Fri Dec 07, 2001 2:39 pm
Location: Yorkshire, UK

Post by Daz »

romans1423,

Have a read of This...
Please and Thank You works wonders...
I reserve the right to post illogical (and totally wrong) replies.
...It's the subtle perfection in attention to detail that makes your work rock the way it does - cdkrg
Think simple - it's not necessarily what you draw that matters, it's what you perceive - Daz

Note: ForumImages<dot>com is no longer anything to do with me.
User avatar
Carpe Diem
Registered User
Posts: 580
Joined: Tue Dec 10, 2002 11:19 pm

Post by Carpe Diem »

romans1423 wrote: Won't this affect the BBCode JavaScript, which reference the posting form by the name "post", not "form" (which this MOD changes it to)??


I really don't understand what kind of a problem you mean this would generate?

I have installed this mod in its original shape, meaning I have only made the same changes that was said in the mod instruction file without changing any other coding text for the bbcode JS, and everything seems to be working just fine.. the submitting of a post with or without bbcodes works just fine so I don't understand what kind of errors I should look for??

I'm using a 2.0.4 board..
User avatar
GPHemsley
Registered User
Posts: 1475
Joined: Fri Apr 18, 2003 3:12 am
Location: Long Beach, NY
Name: Gordon Hemsley
Contact:

Post by GPHemsley »

Carpe Diem wrote: I'm using a 2.0.4 board..

That could be the reason you are not haveing problems... This is a 2.0.5 MOD... (Weird, I know)
User avatar
Carpe Diem
Registered User
Posts: 580
Joined: Tue Dec 10, 2002 11:19 pm

Post by Carpe Diem »

GPHemsley wrote:
Carpe Diem wrote:I'm using a 2.0.4 board..

That could be the reason you are not haveing problems... This is a 2.0.5 MOD... (Weird, I know)


Aha.. hmm... oh well I've decided NOT to upgrade to 2.0.5 for now, as the id_session part is also removed in 2.0.5 and that obviously creates some problems.. anyway thx for the response! 2.0.4 is running without any hassles on my testboard for now so, I'm satisfied.
quentin
Registered User
Posts: 197
Joined: Tue May 20, 2003 7:30 am
Location: Geneva, Switzerland
Contact:

Post by quentin »

However, the JavaScript that you add to the overall_header results in an error on any page that doesn't have a modded form since the header JS references the forms which don't exist on every page...


That can be easily solved by checking the form exists in the javascript before doing anything.
Nice mod.

Quentin
The largest message boards on the web !
Web Design Library (coming soon)
Friends sites: Heroes of might and magic - Biometric security
Whip-lash
Registered User
Posts: 21
Joined: Sun Jun 22, 2003 10:10 pm

Post by Whip-lash »

AbelaJohnB wrote:
romans1423 wrote:Won't this affect the BBCode JavaScript, which reference the posting form by the name "post", not "form" (which this MOD changes it to)??


If you find that happening, I'd be interrested in knowing about it.


Erm, it's happening... :) Please excuse me as I am not very knowlegable in JavaScript, so I'm not sure what I should do to fix this. I'm using 2.0.5, with the Attachment and Visual Verification mods.

Pages without the modified forms specified in the mod documentation get the following error: 'document.form.elements' is null or not an object.

I think what quentin noted should resolve this, that is if the JavaScript could check if the form existed on the page before trying to SetFocus.

Pages with the modified forms that also use the BBcode buttons get errors simlar to this: 'document.post.message' is null or not an object.

What should resolve this would be to have the BBcode use "form" instead of "post"...

Any ideas?
Whip-lash
Registered User
Posts: 21
Joined: Sun Jun 22, 2003 10:10 pm

Post by Whip-lash »

Just wondering if anyone had any thoughts about this yet..., so... *bump*
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Post by drathbun »

I got a version of this mod a long time ago (not this one, someone else wrote it). Here's the javascript that is used, which only works if it finds a form, and then finds the first empty field in that form.

Code: Select all

function focusTextField (form) {

        // first, validate form objects
        if ((typeof form != 'object') || (typeof form.elements != 'object')) {
                return false;
        }

        // set array of elements
        var elements = form.elements;

        // loop through array of elements, finding the first empty input field
        // set focus to that field
        for (var i = 0; i < elements.length; i++) {
                if ((elements[i].type != 'text') &&
                        (elements[i].type != 'password') &&
                        (elements[i].type != 'textarea'))
                {
                        continue;
                }
                if (elements[i].name == 'helpbox') {
                        continue;
                }
                if (elements[i].value == '') {
                        elements[i].focus();
                        break;
                }
        }
        return true;
}
The form name is passed as a parameter. I've been using this for over a year with various versions of phpBB and not had any problems. There are a few hard-coded values to handle specific cases on specific forms.

Dave
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
Haywood Jahelpme
Registered User
Posts: 475
Joined: Wed Oct 23, 2002 9:16 am
Location: San Diego
Contact:

Post by Haywood Jahelpme »

looks sweet... Thanks!
Post Reply

Return to “[2.0.x] MOD Database Cleanup”