Jump to content

Warning User Not To Enter Spaces In Username Field


Dan_Mason

Recommended Posts

Okay, so this is the code i have so far (as an example):

 

<script language="javascript" type="text/javascript">
function removeSpaces(string) {
return string.split(' ').join('');
}
</script>


<form>
<input type="text" onblur="this.value=removeSpaces(this.value);">
<input type="button" value="Click">
</form>

 

 

As you can see, I am automatically removing spaces in the field. Now I know it would be obvious to most people but the majority of people using the login system I am designing are going to be pretty computer illiterate, So i need it to be obvious.

 

 

I want to also have a warning pop-up box If spaces are found and removed saying "Spaces cannot be used in Usernames, spaces have been removed."

 

Can anyone help?

 

 

Thanks in advance :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.