Details
-
Bug
-
Resolution: Fixed
-
Neutral
-
3.4.7
-
None
-
None
-
Empty show more show less
-
DevX 4
-
5
Description
Steps to reproduce
- Create a component in Blossom (e.g, a textField)
- Set a validator:
cfg.fields.text("cityId") .validator(cfg.validators.digitsOnly() .errorMessage("Only numbers")) .label("City Id") .description("Insert the Id of the city")
- Check that when setting the validator, old info.magnolia.ui.form.validator.definition.RegexpValidatorDefinition class is instantiated instead of info.magnolia.ui.field.RegexpValidatorDefinition
- Don't fulfill any value at the previous field (cityId)
- Try to save the dialog
- Check the validator is triggered tho no value has been typed
Expected results
Validator is executed only if the field has data
Actual results
Validator is always executed
Workaround
Switch to new M6UI info.magnolia.ui.field.RegexpValidatorDefinition class
Development notes
This is not directly a Blossom issue, same behavior happens for any field regardless the definition process. E.g, go to our demo and edit the TextAndImage component. At the headline section include the following validator (old class):
- name: headline
class: info.magnolia.ui.form.field.definition.TextFieldDefinition
i18n: true
validators:
- name: digitsOnly
class: info.magnolia.ui.form.validator.definition.RegexpValidatorDefinition
pattern: ^\d{5}(-\d{4})?$
errorMessage: Please, enter a number
Now go to Pages app, create a new page and on the main area, create a TextAndImage component. Try to save it without inputing any value and check the validator is executed.
Perform the same test at the mtk2 with the new regexValidator class:
validators: numberValidator: $type: regexpValidator pattern: ^[+]*[0-9\s]* errorMessage: Please enter a number
Check that if you try to save the dialog when no data has been included at the headline field, the dialog gets saved properly.
Checklists
Attachments
Issue Links
- relates to
-
BLOSSOM-290 Enable UI 6 definition usage in dialog/tab factories
-
- Closed
-