GotKnowHow.com

Can i check blank spaces in input field?

i want know whether i can check blank spaces in a input field, i can check whether the field is left empty or something is entered, but when the user just press space bar and fills blanks spaces, its assumed as something has been entered, can this be checked in javascript
Aug 27th, 2010


0
1 in Education & Reference Report

1 Answer

0 

I would actually use a Regular Expression (Regex) to check for blank spaces in a textbox.

For instance the following regex should check for multiple blank white spaces on a line: ^( *)$

If you're using ASP.NET, I would use the RequiredFieldValidator control, which actually checks for blank input fields.  Or you could use a RegularExpressionValidator control and write your own regex, with the ValidationExpression="^( *)$"

Answer this question

by Anonymous - Already have an account? Login now!
Your Name:  

Your Answer:  
Source(s): (optional)
Enter the text you see in the image below
What do you see?
Can't read the image? View a new one.
Please allow up to 60 sec for your answer to be saved.
Your answer will appear after being approved.



Ask a Question

140 characters left

Most Popular Tags

acronym (6533) ncaa football (120)
abbreviation (6475) facebook (107)
height (5259) holiday (91)
tall (5255) ipad (86)
text message (1065) cat (76)
football (263) emoticon (74)
iphone app (231) ipad app (69)
iphone (217) hockey (66)
nfl (159) nhl (66)
radio (139) nba (42)
college football (121) baseball (41)
football radio (120) basketball (38)

Learn the famous formula for money-making, based upon the THIRTEEN PROVEN STEPS TO RICHES! Get your FREE Copy & Instant Access to Think and Grow Rich by Napoleon Hill just by signing up.
 
   
Newsletter cover