Problem/Motivation
The value input of the math tamper plugin only accepts integers.


And it's weird because I already have an active math tamper multiplying by 1.0E-18 on the same site and I cannot think of a configuration change that could have broken the input in the meantime.
Steps to reproduce
Drupal 9.3.0
Feeds 8.x-3.0-beta1
Feeds Tamper 8.x-2.0-beta2
Add a feed type with a mapping to a Number (float) field
Add a math pluging tamper to that field
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | integer-error.png | 709.2 KB | kopeboy |
| decimal.png | 20.89 KB | kopeboy | |
| scientific.png | 26.53 KB | kopeboy |
Comments
Comment #2
kopeboyAnd when you actually put an integer, this error appears on saving
(but the plugin works as expected during feed import)
Comment #3
megachrizI see that the number field in Drupal outputs HTML like this:
Note that the value of the step attribute is set to
1. I think this implies that only integers are accepted. According tohttps://isotoma.com/blog/2012/03/02/html5-input-typenumber-and-decimalsf... that attribute should be set to "any" to allow decimal and float values too.
The code for the Math plugin is in tamper/src/Plugin/Tamper/Math.php. I think that the trick would be to instruct Drupal to use "any" as the value for the "step" attribute.
The error message seems to occur only when selecting the "division" operation.
Comment #4
kopeboyThank you for the quick reply!
For other readers, I found more relevant info here as well:
https://www.drupal.org/project/drupal/issues/2230909
Comment #5
megachrizI think that this issue was fixed in the Tamper module in #3418803: Plugin Math: just integer values are accepted. If not, feel free to reopen.