The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Disallow Characters in Username

View previous topic View next topic Go down

Solved Disallow Characters in Username

Post by nextlevelgaming on October 20th 2012, 2:12 pm

Hey Rideem, LG, Sanket, or anyone else. I'm looking through the ACP and trying to find if there is a section where we can disallow a certain character.
Reason I ask Rideem is this is for your code, and my click function code, you say no spaces allowed in the username correct? How would I make it so no users can create a space in their username.

nextlevelgaming
Forumember

Male Posts : 989
Reputation : 38
Language : English|CSS|HTML5|javascript|
Location : New York

http://www.easybbtutorials.forumotion.com

Back to top Go down

Solved Re: Disallow Characters in Username

Post by LGforum on October 20th 2012, 2:35 pm

ACP - General - Username Censoring.

Just put '* *' without the speech marks as a censor. That should prevent spaces in usernames.

LGforum
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Solved Re: Disallow Characters in Username

Post by nextlevelgaming on October 20th 2012, 5:13 pm

No I know about the %20, but I don't believe users will remember so, instead I will disallow the space altogether. they can use other things to give it a space lol. And thanks LG let ya know if it worked

Did not work

I added it like so * *

nextlevelgaming
Forumember

Male Posts : 989
Reputation : 38
Language : English|CSS|HTML5|javascript|
Location : New York

http://www.easybbtutorials.forumotion.com

Back to top Go down

Solved Re: Disallow Characters in Username

Post by LGforum on October 21st 2012, 8:08 pm

Could try *%20*

LGforum
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Solved Re: Disallow Characters in Username

Post by nextlevelgaming on October 21st 2012, 8:12 pm

with the asteriks? Cuz I tried %20 and ' ' "That is three spaces without the speech marks.

nextlevelgaming
Forumember

Male Posts : 989
Reputation : 38
Language : English|CSS|HTML5|javascript|
Location : New York

http://www.easybbtutorials.forumotion.com

Back to top Go down

Solved Re: Disallow Characters in Username

Post by LGforum on October 21st 2012, 8:18 pm

Yes the asterisks are wildcards. Meaning that they can mean any amount of any thing.
So *%20* means, a space with any amount of anything before it, and any amount of anything after it. Essentially censoring any usage of a space in a username.

LGforum
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Solved Re: Disallow Characters in Username

Post by nextlevelgaming on October 21st 2012, 8:20 pm

okie dokie ill try er out LG

Ok so did not work as well. This is frustrating me quite a bit actually. Something sooo simple ya know... What about this code

Code:
<script type="text/javascript">

function nospaces(t){

if(t.value.match(/\s/g)){

alert('Sorry, you are not allowed to enter any spaces');

t.value=t.value.replace(/\s/g,'');

}

}

</script>

And add this to username field
Code:
onkeyup="nospaces(this)"

Though I don't know where the registration username field so located in templates...

nextlevelgaming
Forumember

Male Posts : 989
Reputation : 38
Language : English|CSS|HTML5|javascript|
Location : New York

http://www.easybbtutorials.forumotion.com

Back to top Go down

Solved Re: Disallow Characters in Username

Post by LGforum on October 21st 2012, 10:50 pm

Yes you could do that. Though I don't know why the censor won't allow a space...

You could add an event listener (may as well jQuery it):
Code:
$('#username_reg').keyup(function(e) {
    if(e.keyCode === 32) alert('No space are allowed in usernames');
});
But people can get passed it if they disable Javascript ... however chances of them doing that are very small, unless they are just trying to be annoying Razz

LGforum
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Solved Re: Disallow Characters in Username

Post by nextlevelgaming on October 22nd 2012, 12:00 am

cheers I hope this works, and I know I was hoping it would censor it! Be alot easier then having to do another code. What would happen if they had it disabled? No alert?

nextlevelgaming
Forumember

Male Posts : 989
Reputation : 38
Language : English|CSS|HTML5|javascript|
Location : New York

http://www.easybbtutorials.forumotion.com

Back to top Go down

Solved Re: Disallow Characters in Username

Post by nextlevelgaming on October 22nd 2012, 7:31 pm

No, neither codes worked, nor did the alert show. So I am still focusing on figuring this out. I want to keep this open incase someone needs this, and I find the answer

nextlevelgaming
Forumember

Male Posts : 989
Reputation : 38
Language : English|CSS|HTML5|javascript|
Location : New York

http://www.easybbtutorials.forumotion.com

Back to top Go down

Solved Re: Disallow Characters in Username

Post by nextlevelgaming on October 22nd 2012, 8:29 pm

Code:
$(window).ready(function(){
?

nextlevelgaming
Forumember

Male Posts : 989
Reputation : 38
Language : English|CSS|HTML5|javascript|
Location : New York

http://www.easybbtutorials.forumotion.com

Back to top Go down

Solved Re: Disallow Characters in Username

Post by nextlevelgaming on October 22nd 2012, 8:31 pm

Ill try it again. Sorry man, didn't know what ya meant lol

worked like a charm Smile

Now how come

Code:
$(function() {
$('#username_reg').keyup(function(e) {
    if(e.keyCode === 32) alert('No space are allowed in usernames');
});
});
that worked

and this does not?

Code:
$(window).ready(function() {
$('#username_reg').keyup(function(e) {
    if(e.keyCode === 32) alert('No space are allowed in usernames');
});
});

I get the above u gave is DOM. but can you explain the differences please?

nextlevelgaming
Forumember

Male Posts : 989
Reputation : 38
Language : English|CSS|HTML5|javascript|
Location : New York

http://www.easybbtutorials.forumotion.com

Back to top Go down

Solved Re: Disallow Characters in Username

Post by LGforum on October 22nd 2012, 8:36 pm

Window, doesn't have a ready listener. It has a 'onload' event.

So you could do $(window).load(function(){ , or window.onload = function() {
However, DOM Readiness comes before the window is loaded.

LGforum
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Solved Re: Disallow Characters in Username

Post by nextlevelgaming on October 22nd 2012, 8:44 pm

Yes sir, thank you very much for the explanation. And now, your tagging system, and my click func. Is going to be perfect on my site Smile

nextlevelgaming
Forumember

Male Posts : 989
Reputation : 38
Language : English|CSS|HTML5|javascript|
Location : New York

http://www.easybbtutorials.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum