Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decimal mark (dot or comma) #1232

Closed
jrusinek opened this issue Aug 7, 2014 · 8 comments
Closed

Decimal mark (dot or comma) #1232

jrusinek opened this issue Aug 7, 2014 · 8 comments

Comments

@jrusinek
Copy link

jrusinek commented Aug 7, 2014

The number type doesn't accept comma as decimal mark, only dot. 40% percent of people are forced then to modify the plugin or write custom rules.

Parameter would be very cool.

@karczk
Copy link

karczk commented Aug 7, 2014

Good idea. In every project I have to overwrite the following methods by loading custom script after jquery-validation:
$.validator.methods.range
$.validator.methods.number

@staabm
Copy link
Member

staabm commented Aug 9, 2014

Changing number to allow also floats would be a BC break. Also adding floats would require to know which sign is the separator, sometimes its comma, sometimes its a dot -> l10n

@staabm
Copy link
Member

staabm commented Aug 9, 2014

Hmm just read the html5 spec, which defines it to allow floating numbers. Therefore it seems we need to change that for spec compilance
http://www.w3.org/TR/html-markup/input.number.html

Could you PR a unit test and your patch?

@jrusinek
Copy link
Author

jrusinek commented Aug 9, 2014

Would adding two options (decimal-mark, thousand-mark) with default values be a bad idea?

@staabm
Copy link
Member

staabm commented Aug 9, 2014

I re-read your initial post. I didn't got what you mean at first.

I think we should decide which separator to use based on a locale, maybe even with a override using a parameter/config-option

@jrusinek
Copy link
Author

jrusinek commented Aug 9, 2014

Sorry if I wasn't clear enough. Glad you know what I meant.

When you mention locales, I immediately think about Microsoft's jQuery Globalization, but I just heard the name and have no experience with that, so it's up to you how this thing should be handled.

@hidegh
Copy link

hidegh commented Aug 9, 2014

this stuff can be done with globalize and https://github.com/johnnyreilly/jquery-validation-globalize

@jzaefferer
Copy link
Collaborator

This number method implementation in src/localization/methods_de.js does that. You could just use that implementation, with whatever locale uses the same format.

Eventually this will get addressed by #581, but that will likely still take a while. As mentioned there and in the comment above, the jquery-validation-globalize project can be used right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants