cancel
Showing results for 
Search instead for 
Did you mean: 

Number Format

Former Member
0 Kudos

Hello Experts,

I have an input field called "OpenQuantity" in my application where user can enter only number ( float or decimal are also allowed). I have put a validation from UI side to check whether an end user is entering number or not by using javascript method isNaN(). My applicatiion would be used in different countries. In France, they will use comma instead of decimal where if the user entered 5,6 my application will throw an error that it is not number. So mean to say isNaN() is not working for french language.

Could anyone please help me or suggest what kind of validation I can write in my application so that it can work for all the countries.

Regards,
Abhimanyu

Accepted Solutions (0)

Answers (2)

Answers (2)

SergioG_TX
Active Contributor
0 Kudos

how about a regular expression - something like a digit followed by a comma or a period followed by a digit

//\d+(\,|\.){0,1}\d+/g

something like that - hope it works

SergioG_TX
Active Contributor
0 Kudos

what about a regular expression for numbers and either a dot or a comma in between:

something like

/\d+(\.|\,){1}\d+/g

1 or more digits followed by a dot/comma followed by 1 or more digits

hope it works