Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within HTML Pages with CSS and JavaScript
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework
this week in the
Java in General
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Liutauras Vilda
Ron McLeod
Sheriffs:
Jeanne Boyarsky
Devaka Cooray
Paul Clapham
Saloon Keepers:
Scott Selikoff
Tim Holloway
Piet Souris
Mikalai Zaikin
Frits Walraven
Bartenders:
Stephan van Hulst
Carey Brown
Forum:
HTML Pages with CSS and JavaScript
Validation for double in javascript
Inderveer singh
Greenhorn
Posts: 15
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Has anyone got a javascript validation for a text field which accepts XX.XX as proper number entry. (e.g 98.87)
Eric Pascarello
author
Posts: 15385
6
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
<html> <head> <script type="text/javascript"> function ValNumber(){ //var regEx = /^\d{1,2}\.\d{1,2}$/; var regEx = /^\d{2}\.\d{2}$/; bValid = document.Form1.t1.value.match(regEx); if(!bValid){ alert('incorrect format'); return false; } else return true; } </script> </head> <body> <form name="Form1" onsubmit="return ValNumber()"> <input type="text" name="t1"> <input type="submit" name="btnSub"> </form> </body> </html>
Eric
Honk if you love justice! And honk twice for tiny ads!
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Validator Problem?
Restricting HTML elements in a textarea
how to show validation error messages on the jsp login fields from servlet
date validation
Reloading form page when there's error
More...