By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,536 Members | 2,165 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,536 IT Pros & Developers. It's quick & easy.

Javascript Code for Not accepting Zero when entered alone in a Text Box

nitindel
P: 67
Hi,
I have a text Box and want to apply javascript validation for not accpting Only Zero(s). For eg. If i enter 002308 ,it should accept but if enter 00000 or any number of Zeros alone ,it shold throw Error..

Please tell.It's Urgent.

Thanks & Regards
Nitin Sharma
Dec 18 '07 #1
Share this Question
Share on Google+
3 Replies


Shashi Sadasivan
Expert 100+
P: 1,435
Hi,
I have a text Box and want to apply javascript validation for not accpting Only Zero(s). For eg. If i enter 002308 ,it should accept but if enter 00000 or any number of Zeros alone ,it shold throw Error..

Please tell.It's Urgent.

Thanks & Regards
Nitin Sharma
Hi nitindel
Welcome to TSDN.

Please post your questions in the right forum so that you can recieve a more quicker and better resposnce from the experts residing in that Forum.

-Shashi
Dec 18 '07 #2

nitindel
P: 67
Hi nitindel
Welcome to TSDN.

Please post your questions in the right forum so that you can recieve a more quicker and better resposnce from the experts residing in that Forum.

-Shashi
Sure ...I will take care from noe onwards...
Please tell the solution now...

Thnaks in Advance
Nitin Sharma
Dec 18 '07 #3

acoder
Expert Mod 15k+
P: 16,027
I have a text Box and want to apply javascript validation for not accpting Only Zero(s). For eg. If i enter 002308 ,it should accept but if enter 00000 or any number of Zeros alone ,it shold throw Error..
Use a regular expression, e.g. /^[0]+$/ should match all zeros only. See this link on how to use regular expressions in JavaScript.
Dec 18 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.