-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Describe the bug
The TextField component does not seems to be treating space character " " as empty value, which was the case in previous version ("formiojs": "4.13.10")
Version/Branch
version: 5.0.1
To Reproduce
Steps to reproduce the behavior:
- Create empty form
- Add TextField component
- Set TextField -> Validation -> Required to checked
- Add Button component
- Set Button -> Disable on Form Invalid to checked
- Open the form
- Enter space in the TextField
Expected behavior: Required area is displayed, and the Submit button remain disabled
Actual behavior: the Submit button is enabled
minimum form components for replication
"components": [ { "input": true, "tableView": true, "label": "Text Field", "type": "textfield", "key": "textField", "validate": { "required": true } }, { "input": true, "showValidations": false, "tableView": false, "label": "Submit", "type": "button", "disableOnInvalid": true, "key": "submit", "saveOnEnter": false } ],
Screenshots
now:
previous:
Additional context
I believe this to be due to the switch from component defined validation in previous version which include trim to input value
https://github.com/formio/formio.js/blob/v4.13.1/src/validator/rules/Required.js#L9
https://github.com/formio/formio.js/blob/v4.13.1/src/components/textfield/TextField.js#L165
to centralized validation definition which does not perform trim before the validation