Support Article

Cannot enter commas in currency control field

SA-28990

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

  1. Add a currency control to a section
  2. Set the Editable Format Type to "Number" and ensure the "Display value using read-only formatting" checkbox is unchecked
  3. Launch the user portal and navigate to the section
  4. 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:
  1. Optionally, the first character may be a "-" character.
  2. One or more characters in the range "0—9".
  3. Optionally, the following parts, in exactly the following order:
    1. a "." character
    2. one or more characters in the range "0—9"
  4. Optionally, the following parts, in exactly the following order:
    1. a "e" character or "E" character
    2. optionally, a "-" character or "+" character
    3. One or more characters in the range "0—9".
These restrictions are applied regardless of any locale settings (at the OS, browser, or application level) or any other context (such as type of currency).  Some browsers (like Chrome) enforce these restrictions by ignoring any keyboard input that is not permitted.

Resolution

Commas can be allowed as valid currency input using the following combination of settings:

  1. Editable Format Type: "Number" (this is required to display the following checkbox)
  2. Check the "Display value using read-only formatting" checkbox
  3. Read-Only Format Type: "Number" (this is required to display the separator options)
  4. 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 7, 2016 - Updated October 11, 2016


0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.