Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Many countries in europe are using the comma for the decimal separator instead of a point. There are already different formatters for different output, but when submitting a number decimal text field, the comma would be filtered out. So I added a additional select option to the field settings, where you can choose whether decimal numbers are separated by comma or point. If the comma is selected as separator, the comma is then replaced by a point for storage.
Comment | File | Size | Author |
---|---|---|---|
number_dec_sep.patch | 2.01 KB | mh86 |
Comments
Comment #1
dopry CreditAttribution: dopry commentedIs this still an issue should it be bumped to 6.x?
Comment #2
alexanderpas CreditAttribution: alexanderpas commentedBoth the comma and the point should be considered as a decimal seperator, with the space as a thousands seperator.
http://en.wikipedia.org/wiki/ISO_31-0#Numbers
Comment #3
dopry CreditAttribution: dopry commentedThis seems like more a localization issue. I'm not sure is any localized input support is available in core for D6, we'll have to check up on it first. I don't think we can blindly replace , with . since it is a common thousands seperator in the US, so the str_replace in this version won't work.
I would also be nice to have the field/widget just be smart enough to figure this out on it's own... Maybe we should look to date.module and it's input formats for inspiration?
Also 4.7.x will not see this patch can we re-roll for HEAD and I'm sure we can backport through versions as necessary.
Comment #4
brmassa CreditAttribution: brmassa commentedGuys,
the custom decimal marker are already on 6.x, but there is a problem. every time the node is saved, a message is displayed telling about the change from comma to point: "Only numbers and the decimal character (,) are allowed in FIELD. 150,00 was changed to 150.00."
if i keep updating the node, it keep showing the same message over and over again. its very strange.
regards,
massa
Comment #5
alexanderpas CreditAttribution: alexanderpas commentedat least that message has a bug! comma only allowed... changed to point... will give a kind of infinite loop situation...
Comment #6
brmassa CreditAttribution: brmassa commentedi forgot to set it was a bug
Comment #7
yched CreditAttribution: yched commentedFixed.
BTW, are there *really* places in the world that would use a whitespace as a comma separator ??
Comment #8
brmassa CreditAttribution: brmassa commentedYves,
good question!
regards,
massa
EDIT: there is no mention on http://en.wikipedia.org/wiki/Decimal_separator. Only comma, dot and "Non-Arabic Numerals"
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #10
najibx CreditAttribution: najibx commentedhttp://drupal.org/node/109246
still not fixed isn't?