I'm using Spring MVC and dojo in my project.
We need to have an input for phone number by given format like: (###) ###-####
The phone number should automatically format as it's being typed.
The validation should be inside the text field it self with placeholder per each digit separated by '-'.
I tried to look over the web for an exist solution but I couldn't find any.
Can you try this library for phone number format?
https://www.npmjs.com/package/libphonenumber-js
Related
I have a list of phone numbers in different formats like '1234567-8901', '49123456 6544', '861234567899', and lots of other formats also. I want to format the phone number in the format like for example lets take USA phone number, it should display like '+ 1 xxx-xxx-xxxx'. We are using thymeleaf and js for implementing this.Please tell me the step by step process on how to implement this?
You can use regex to solve this. I would suggest taking a look at this stack overflow answer https://stackoverflow.com/a/8358141/19184713
How to allow user only japanese numbers input for mobile field?
disabled other input.
This SO thread has almost exactly what you need.
In short, you use Regex to validate that only Japanese characters were used. You can use jquery.validate.js or write it all out yourself.
I'm not able to make xeditable work with localized decimal numbers.
I have searched both in the official documentation and online in other forums/websites but I wasn't able to get any clue.
The only similar issue was this SO question: AngularJS xeditable number field with float validation
To sum up the problem: I would like to use a comma instead of a dot as a decimal separator but x-editable automatically transform the separator in a dot when I go into "edit mode". How can I deal with localization for decimal numbers?
Here is the code
<span e-form="rowform" e-name="value.value" editable-text="property.value.value" onbeforesave="checkIsNumeric($data)">
{property.value.value || 'empty'}}
</span>
Have you tried using a locale file like described in the angular i18n documentation? You should pick one of your language that already contains a comma. Otherwise theoretically you could manipulate your locale file and add a comma as decimal separator. The different locale files (angular 1.4.7) can be downloaded here for example.
I am looking for version number mask plugin. I want to validate version number entered in textbox that should in format of X.Y.Z or XX.YY.ZZ and XYZ should in number.
Please help me if there is any plugin in jquery or GWT to validate this.
You can use GWT RegExp functions.
I have a field called price, now how to validate this field by java script? It will take only integer value and dot. It may take decimal point or not.
e.g 200,200.00 both are valid.
How shall I do that?
There are many ways to achieve this.
Without the use of any 3rd party libraries i would recommend using regular expressions.
A possible pattern used to validate price would be
\d[\d\,\.]+
here is a tutorial on using regular expressions to validate fields in java-script
Tutorial
Hope this helps