jQuery in Action
[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Reply Bookmark it! Watch this topic JavaRanch » Forums » Engineering » HTML and JavaScript
 
RSS feed
 
New topic
Author

restrict space bar use on textfield on jsp pages

niraj karki
Greenhorn

Joined: Jul 02, 2009
Messages: 1

Dear Friends I am having problem to restrict my customers for using space bar on text field .

I dont want them to use space in text box while filling form..

Can I get any jsp codes to restrict use of space ..


Bear Bibeault
Author and opinionated walrus
Sheriff

Joined: Jan 10, 2002
Messages: 36591

No. This is not something you will be able to do with JSP. You will need to use JavaScript.

[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
ujjwal soni
Ranch Hand

Joined: Mar 28, 2007
Messages: 355

Hi,

You can do something like this using javascript to prevent space bar.l



^ ^
|| ||
A trigger that detects To check which key is pressed (Here 32 is the key code for space bar)
each key down event

This message was edited 1 time. Last update was at by ujjwal soni


Cheers!!!
Ujjwal B Soni <baroda, gujarat, india> <+919998971048>
"Helping hands are better than praying lips......"
Eric Pascarello
author
Sheriff

Joined: Nov 08, 2001
Messages: 13577

How about you just replace the spaces on the server and not worry about it at all?

Eric

Race Schedule for 2010 for this running geek:
* National Half Marathon - 03/20 * Frederick Marathon - 05/02 * Baltimore Marathon - 10/16 *
 
jQuery in Action
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Engineering » HTML and JavaScript
 
RSS feed
 
New topic
MyEclipse Enterprise Workbench