Dear Experts
I want textbox1 to accept only numeric data as 55,65,698.00
Is there any easy way to validate textbox1 with javascript?
Please help
Jump to PostAssuminbg this is a Java question, not JavaScript, use a JFormattedTextField
Formatted text fields provide a way for developers to specify the valid set of characters that can be typed in a text field. Specifically, the JFormattedTextField class adds a formatter and an object value to the features inherited from …
this is a Java forum, not a JavaScript forum (no, they are not the same)
and to answer your question: yes, there is, and even if I'm mistaken and it's not a standard validation, it's not that hard to write.
Use some regex pattern to check the contents of the textbox: if it matches [^0-9,], you have a non-numerical input.
Assuminbg this is a Java question, not JavaScript, use a JFormattedTextField
Formatted text fields provide a way for developers to specify the valid set of characters that can be typed in a text field. Specifically, the JFormattedTextField class adds a formatter and an object value to the features inherited from the JTextField class. The formatter translates the field's value into the text it displays, and the text into the field's value.
Using the formatters that Swing provides, you can set up formatted text fields to type dates and numbers in localized formats. Another kind of formatter enables you to use a character mask to specify the set of characters that can be typed at each position in the field. For example, you can specify a mask for typing phone numbers in a particular format, such as (XX) X-XX-XX-XX-XX.
http://docs.oracle.com/javase/tutorial/uiswing/components/formattedtextfield.html
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.
You're trying to visit a URL that doesn't currently exist on the web. Most likely, a member posted a link a long time ago to a web page that has since been removed. It's also possible that there was a typo when posting the URL. We redirect you to this notice instead of stripping out the link to preserve the integrity of the post.