Link to home
Start Free TrialLog in
Avatar of pinaldave
pinaldaveFlag for India

asked on

text box on blur validation for empty field

hello,
I am using following script to make sure in the text box that when I leave it ... it allows does not allow anything else than numeric. Numbers are allowed only. Empty string should be allowed but when user leave the text box the empty string should be converted to zero automatically.
How can I do this>>>
When user leaves the text box the empty string is replaced by Zero (0) Digit.
This is what I have >>>
onBlur="if (/\D/.test(this.value)){alert('Please enter the digits only');this.focus()}""
Regards,
ASKER CERTIFIED SOLUTION
Avatar of Colosseo
Colosseo
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pinaldave

ASKER

Thank you very much for quick and correct answer.
Regards,
---Pinal
Your very welcome, thank you for the grade.

Cheers

Scott