You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There appears to be an issue with the money field where entering negative values results in the field displaying as empty. Despite being able to save -999 as the minimum value for the field, entering and saving a negative value like -999 in an entry causes the value to disappear.
Additionally, there seems to be a discrepancy in the display of minimum and maximum values when set to -999 and 999, which appear as -99,000 and 99,900, respectively. This might be related to currency formatting, particularly with Japanese Yen, but it could be affecting other currencies as well.
The documentation wasn't clear on whether negative values can be entered. However, since the following query was mentioned, I assumed that negative values might be allowed.
Navigate to the settings of the money field in question.
Remove the default minimum value of 0 and set the minimum value to -999.
Save the settings.
Attempt to Input Negative Value:
Go to an entry that uses the modified money field.
Try to input a value of -99 and save the entry.
Observe that the field appears empty instead of displaying the entered value.
===
Check Display of Minimum/Maximum Values:
Set the minimum and maximum values of the field to -999 and 999, respectively.
Observe the displayed values; instead of showing -999 and 999, the field displays -99,000 and 99,900.
Note that this issue might be related to currency formatting, particularly with Japanese Yen.
Expected behavior
Modify Field Settings:
After removing the default minimum value of 0 and setting the minimum value to -999, the field should accept and display negative values without issue.
Attempt to Input Negative Value:
When a negative value like -99 is entered into the field and the entry is saved, the field should correctly display the entered negative value instead of appearing empty.
I would first like to know if negative values can be used in the money field.
===
Check Display of Minimum/Maximum Values:
When the minimum and maximum values of the field are set to -999 and 999, they should be displayed as -999 and 999 respectively, without unexpected changes (e.g., -99,000 and 99,900). The field should accurately reflect the specified values according to the selected currency formatting, including for Japanese Yen.
Actual behavior
Attempt to Input Negative Value:
When a negative value like -99 is entered into the field and the entry is saved, the field appears empty instead of displaying the entered value.
set value
after save
===
Check Display of Minimum/Maximum Values:
When the minimum and maximum values of the field are set to -999 and 999, they are unexpectedly displayed as -99,000 and 99,900, respectively. This discrepancy seems to be influenced by the currency formatting, particularly for Japanese Yen, leading to incorrect value displays.
set value
after save
Craft CMS version
5.3.4
PHP version
8.2.22
Operating system and version
Linux 3.10.0-957.27.2.el7.x86_64
Database type and version
MySQL 8.0.35
Image driver and version
Imagick 3.7.0 (ImageMagick 6.7.8-9)
Installed plugins and versions
CKEditor 4.1.0
Multi Translator 2.7.0
The text was updated successfully, but these errors were encountered:
Hi, thanks for reporting and for the detailed description!
Yes, negative values are allowed in the money field. It looks like there’s a bug (only affecting version 5.2.9+) which prevents them from showing correctly after they’re saved in the database.
Display of Minimum/Maximum values with the Japanese Yen currency - that’s also a bug. I raised a PR for that one, too.
What happened?
Description
There appears to be an issue with the money field where entering negative values results in the field displaying as empty. Despite being able to save -999 as the minimum value for the field, entering and saving a negative value like -999 in an entry causes the value to disappear.
Additionally, there seems to be a discrepancy in the display of minimum and maximum values when set to -999 and 999, which appear as -99,000 and 99,900, respectively. This might be related to currency formatting, particularly with Japanese Yen, but it could be affecting other currencies as well.
The documentation wasn't clear on whether negative values can be entered. However, since the following query was mentioned, I assumed that negative values might be allowed.
https://craftcms.com/docs/5.x/reference/field-types/money.html#querying-elements-with-money-fields
Steps to reproduce
===
Expected behavior
I would first like to know if negative values can be used in the money field.
===
Actual behavior
set value
after save
===
set value
after save
Craft CMS version
5.3.4
PHP version
8.2.22
Operating system and version
Linux 3.10.0-957.27.2.el7.x86_64
Database type and version
MySQL 8.0.35
Image driver and version
Imagick 3.7.0 (ImageMagick 6.7.8-9)
Installed plugins and versions
The text was updated successfully, but these errors were encountered: