This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes validating if the input value is float?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "validating if the input value is float??" Watch "validating if the input value is float??" New topic
Author

validating if the input value is float??

rammie singh
Ranch Hand

Joined: Mar 26, 2009
Posts: 116
Hi ..... i want to make a validation for my input text..whether it is float or not...
How can i do it through javascript.

please help.

i tried doing something like this...




and my javascript function is..




but on my jsp page it gives error saying an object is expected..
please help ... although the alert staement in the function that is alert("float value is.."+floatValue); is getting printed fine
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

*All* text input values are just that: text. You'd need to check against a regular expression, or maybe try converting it and checking for failure--but that may be error-prone.

Also, note that isFloat() is actually Number.isFloat(), not a standalone function.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: validating if the input value is float??
 
It's not a secret anymore!