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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.