Support Article
Cannot enter commas in currency control field
Summary
Commas cannot be entered into currency control input fields, even if the browser locale or currency would use a comma as a decimal separator.
Error Messages
Not Applicable
Steps to Reproduce
- Add a currency control to a section
- Set the Editable Format Type to "Number" and ensure the "Display value using read-only formatting" checkbox is unchecked
- Launch the user portal and navigate to the section
- Attempt to use a comma in the currency control input field
Root Cause
When the currency control is set to use the "Number" format for it's editable formatting, the HTML input type for the field becomes "number" which uses the following definition for valid input values:A floating-point number consists of the following parts, in exactly the following order:
- Optionally, the first character may be a "-" character.
- One or more characters in the range "0—9".
- Optionally, the following parts, in exactly the following order:
- a "." character
- one or more characters in the range "0—9"
- Optionally, the following parts, in exactly the following order:
- a "e" character or "E" character
- optionally, a "-" character or "+" character
- One or more characters in the range "0—9".
Resolution
Commas can be allowed as valid currency input using the following combination of settings:
- Editable Format Type: "Number" (this is required to display the following checkbox)
- Check the "Display value using read-only formatting" checkbox
- Read-Only Format Type: "Number" (this is required to display the separator options)
- Separators: "Yes"
Using this combination of settings will result in the currency input field being generated with the html input type "text" which is more permissive. This will allow both commas and periods as valid input.
Note: with this configuration, other non-numeric chracters will be allowed in the field, so other custom validation may be required to ensure valid input values.
Published October 11, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.