1

Topic: Hard Cover Mod: Ajax username and email check

This is my answer for the AtPetat's feature request I've just made and I thank him for kind of moving me to do it. Also thanks to vldPersonals reusable functions.

1. Open your lang.lib.account_register.php and add these lang strings:

"username_ok" =>
"Username ok",

"email_ok" =>
"Email ok",

2. Open your /includes/js/misc.js and add at the bottom of file this code:

// username check
function check_item(item_type, item_id, emptyfield)
{
    var item_value = $('#'+item_id).val();

    $.post(virpath+'index.php?m=ajaxcheck', {'item_type':item_type,'item_value':item_value},
        function(response) {
            var response = response.split("|");
            if ( response.length == 2 )
            {
                if ( response[0] == 'ok' && response[1] )
                {
                    document.getElementById(item_id+'_check').style.color = '#5B5BFF';
                    $('#'+item_id+'_check').html(response[1]);
                    return true;
                }
                else if ( response[0] == 'notok' && response[1] )
                {
                    document.getElementById(item_id+'_check').style.color = '#FF0000';
                    $('#'+item_id+'_check').html(response[1]);
                    return true;
                }
            }

        }
    );
}

3. Download http://www.zhunussov.com/uploads/lib.ajaxcheck.zip
Unzip and place in your /includes/lib/ directory.

4. Open your account_register.tpl and make two replacements (softgreen template example):

<dd><input name="username" type="text" class="text" id="field_username" value="{registration_username}" size="32" maxlength="16" /></dd>
<dd><input name="username" type="text" class="text" id="field_username" onBlur="check_item('username','field_username');" value="{registration_username}" size="32" maxlength="16" />&nbsp;<span id="field_username_check">&nbsp;</span></dd>

and

<dd><input type="text" class="text" id="field_email" name="email" value="{registration_email}" size="32" maxlength="64" /></dd>

to:

<dd><input type="text" class="text" id="field_email" name="email" onBlur="check_item('email','field_email');" value="{registration_email}" size="32" maxlength="64" />&nbsp;<span id="field_email_check">&nbsp;</span></dd>

Now you have on-fly username and (first) email address check with the all existing validation rules etc.

Best regards,
Radioactive

www.vldMagic.com - first choice customizations help desk
www.vldCrowd.com/radioact - my profile at vldCrowd

2

Re: Hard Cover Mod: Ajax username and email check

WOW, works GREAT - Radioact, Youre my hero when McGuyver dies

3

Re: Hard Cover Mod: Ajax username and email check

Thank you AtPetat and Freja smile

www.vldMagic.com - first choice customizations help desk
www.vldCrowd.com/radioact - my profile at vldCrowd

4

Re: Hard Cover Mod: Ajax username and email check

AtPetat, hope this McGuyver is really really great big_smile
Thank you Radioact for once again sharing your work with us!

Can someone tell how this mod works?

Thank you!

- From the beginning I was intelligent, but since I learn something every day, I'm sure I'll end up wise as well -

5

Re: Hard Cover Mod: Ajax username and email check

Hi Radiact,

This mod was my feature request long time ago, thanks for sharing with us, I used it today, workd perfect with IE, but there is problem with Firefox.

thanks
Kuzey

6

Re: Hard Cover Mod: Ajax username and email check

Hi! You are welcome.
It has no any connection with browser types smile
What kind of problem?

www.vldMagic.com - first choice customizations help desk
www.vldCrowd.com/radioact - my profile at vldCrowd

7

Re: Hard Cover Mod: Ajax username and email check

Hi Radioact,

I think problem is not about connection it is about java I think.

When you browse register page with firefox page is not writing username status.

but it is doing in IE

thanks

8

Re: Hard Cover Mod: Ajax username and email check

Try to refresh twice or more your page (F5) to reload new .js file.

www.vldMagic.com - first choice customizations help desk
www.vldCrowd.com/radioact - my profile at vldCrowd

9

Re: Hard Cover Mod: Ajax username and email check

smile Yes it worked now. thank you very much.

I know this is more big_smile but Can I ask somethink, I saw one of website this feature, instead of writing in near username name field, saw somewhere ajax opening small window writing this OK or Not info.

is that possible?

10

Re: Hard Cover Mod: Ajax username and email check

It is possible smile Definitely possible smile))
What else can I say? smile

www.vldMagic.com - first choice customizations help desk
www.vldCrowd.com/radioact - my profile at vldCrowd

11

Re: Hard Cover Mod: Ajax username and email check

:d

Last edited by Kuzey (2008-04-16 04:21:39)

12

Re: Hard Cover Mod: Ajax username and email check

You can try to combine this mod with one of those tooltip scripts.

www.vldMagic.com - first choice customizations help desk
www.vldCrowd.com/radioact - my profile at vldCrowd