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.
Number module applies a maxlength to the number field widget. This maxlength is set equal to the field's precision. However, the maxlength should actually be two characters larger than the precision: one extra character to support signed values (i.e. negative sign) and one extra character for the decimal separator.
This will also need a test.
Comment | File | Size | Author |
---|---|---|---|
#1 | 950134-decimal.patch | 4.26 KB | mfb |
decimal.patch | 1.23 KB | mfb | |
Comments
Comment #1
mfbAdd a test. This test fails without the patch and (hopefully) passes with the patch.
Comment #2
bleen CreditAttribution: bleen commentedshould we also add s couple of negative tests? for example, if scale = 4, then 1.23456 should fail.
Comment #3
mfbThis is obviously a bare minimum of tests. FYI if you exceed the scale it doesn't fail per se It just doesn't store the extra decimals.
Comment #4
yched CreditAttribution: yched commentedThis looks good.
Comment #5
webchickAwesome, thanks!
Committed to HEAD.