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.
Hello, I apologize if this is covered in another issue but to me it seems different than all those that I've been able to find.
The scenario is that I create a number field with default settings and I'd like to allow the entry of decimals without the leading zero (e.g. .5). I get the validation error message:
Number field field value must format numbers as "12,345.6789".
The value of 0.5 passes validation and the form submits. Is there a way to configure the field to allow the omission of the leading zero for values less than 1?
Thanks
Matt
Comment | File | Size | Author |
---|---|---|---|
#5 | webform-number-decimal-validation-2573523-5.patch | 2.86 KB | DanChadwick |
#2 | webform-number-decimal-validation-2573523-2.patch | 2.29 KB | DanChadwick |
Comments
Comment #2
DanChadwick CreditAttribution: DanChadwick commentedThis was intentional, but I can see that it is a touch restrictive. This patch:
This means that ".5" and "100." are now both accepted, whereas previously they would not have been.
Committed to 7.x-4.x an 8.x.
Comment #5
DanChadwick CreditAttribution: DanChadwick commentedAck. Committed the code before the reg ex commenting.
Committed revision to 7.x-4.x and 8.x.
Comment #8
kaypro4 CreditAttribution: kaypro4 as a volunteer commentedThis worked great! Thanks for the quick fix.
Matt