[BLOSSOM-288] Validator is always executed Created: 17/Jan/22 Updated: 24/Mar/22 Resolved: 17/Feb/22 |
|
| Status: | Closed |
| Project: | Blossom |
| Component/s: | None |
| Affects Version/s: | 3.4.7 |
| Fix Version/s: | 3.5.0 |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Carlos Cantalapiedra | Assignee: | Javier Benito |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | 3h | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Template: | |||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||
| Task DoD: |
[X]*
Doc/release notes changes? Comment present?
[X]*
Downstream builds green?
[X]*
Solution information and context easily available?
[X]*
Tests
[X]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||||||
| Bug DoR: |
[X]*
Steps to reproduce, expected, and actual results filled
[X]*
Affected version filled
|
||||||||||||
| Date of First Response: | |||||||||||||
| Sprint: | DevX 4 | ||||||||||||
| Story Points: | 5 | ||||||||||||
| Description |
Steps to reproduce
Expected resultsValidator is executed only if the field has data Actual resultsValidator is always executed WorkaroundSwitch to new M6UI info.magnolia.ui.field.RegexpValidatorDefinition class Development notesThis 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. |
| Comments |
| Comment by Mikaël Geljić [ 16/Feb/22 ] |
|
rephrasing as this was in fact an independent issue from the fact that blossom still uses old validator packages. |