Welcome visitor
* Login
* Register
It is currently July 24th, 2019, 5:07 am
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » JavaScript



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  validate spaces with javascript
PostPosted: February 11th, 2009, 8:42 pm 
User avatar

Posts: 27
Hi, Im creating a form and, long story short, there is this field that I dont want it to have spaces on it, any idea of how can I do this on the client side? Thank you.


Top
 Profile  
 
  Re: validate spaces with javascript
PostPosted: February 11th, 2009, 8:48 pm 
User avatar

Posts: 63
var str = document.form.field.value; 
if (/\s/.test(str)==true) //this is that it HAS space on it
  {
  str.replace(/\s/, ยท); //just an example of what to do
  }

cheers


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Client Side » JavaScript


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron