Disallow Characters in Username
2 posters
Page 1 of 1
Disallow Characters in Username
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.
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.
Re: Disallow Characters in Username
ACP - General - Username Censoring.
Just put '* *' without the speech marks as a censor. That should prevent spaces in usernames.
Just put '* *' without the speech marks as a censor. That should prevent spaces in usernames.
LGforum- Hyperactive
- Posts : 2265
Reputation : 264
Language : English
Location : UK
Re: Disallow Characters in Username
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 * *
Did not work
I added it like so * *
Re: Disallow Characters in Username
Could try *%20*
LGforum- Hyperactive
- Posts : 2265
Reputation : 264
Language : English
Location : UK
Re: Disallow Characters in Username
with the asteriks? Cuz I tried %20 and ' ' "That is three spaces without the speech marks.
Re: Disallow Characters in Username
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.
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
- Posts : 2265
Reputation : 264
Language : English
Location : UK
Re: Disallow Characters in Username
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
And add this to username field
Though I don't know where the registration username field so located in templates...
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...
Re: Disallow Characters in Username
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):
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');
});
LGforum- Hyperactive
- Posts : 2265
Reputation : 264
Language : English
Location : UK
Re: Disallow Characters in Username
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?
Re: Disallow Characters in Username
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
Re: Disallow Characters in Username
Ill try it again. Sorry man, didn't know what ya meant lol
worked like a charm
Now how come
and this does not?
I get the above u gave is DOM. but can you explain the differences please?
worked like a charm
Now how come
- Code:
$(function() {
$('#username_reg').keyup(function(e) {
if(e.keyCode === 32) alert('No space are allowed in usernames');
});
});
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?
Re: Disallow Characters in Username
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.
So you could do $(window).load(function(){ , or window.onload = function() {
However, DOM Readiness comes before the window is loaded.
LGforum- Hyperactive
- Posts : 2265
Reputation : 264
Language : English
Location : UK
Re: Disallow Characters in Username
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
Similar topics
» Disallow users to change their username
» Username characters limit?
» Changing the Username's Color As Well As Multicolored Username and Glow
» Password> disallow message
» Disallow Invisable Mode
» Username characters limit?
» Changing the Username's Color As Well As Multicolored Username and Glow
» Password> disallow message
» Disallow Invisable Mode
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum