formio / formio.js

JavaScript powered Forms with JSON Form Builder
https://formio.github.io/formio.js
MIT License
1.87k stars 1.06k forks source link

TextField InputMask error #5685

Open corgoss opened 2 months ago

corgoss commented 2 months ago

Describe the bug In old release in the textfield was field inputMask which has value null, but i upgrade the version to the latest and the value of the field changed to empty string. If i dont change from null to "" i got error : TypeError: Cannot read properties of null (reading 'length') at Object.getInputMask More in attachment.

Version/Branch formiojs - 4.21.0 @formio/react - 5.3.0-rc.3

To Reproduce Steps to reproduce the behavior:

  1. Create form
  2. Add component text field
  3. Edit in the component field "inputMask" to the null
  4. See error

Expected behavior It can accept null and empty string

Screenshots

Screenshot 2024-07-10 at 08 56 12 Screenshot 2024-07-10 at 08 56 44

Additional context

ZenMasterJacob20011 commented 1 month ago

It looks like this was added in this commit https://github.com/formio/formio.js/commit/408229e1504ded0f81044d27dcb710ea25667c9b#diff-d859ac9988451f6935f1f9d93f07a5c4330cccd7a2990b3f823375e1a851271c

We use the inputMask property to create input masks for the textfield component as per the InputMask documentation https://robinherbots.github.io/Inputmask/#/documentation

Is there any particular reason why the inputMask needs to accept null and an empty string?

corgoss commented 1 month ago

In the old version of Formio, the inputMask was set to null, and we saved forms using this format. After upgrading Formio, we're now encountering errors on all these forms. We use version formiojs - 4.14.12