[MGNLUI-7668] Validation message not displayed in horizontal layout Created: 02/Dec/22  Updated: 06/Feb/23  Resolved: 06/Feb/23

Status: Closed
Project: Magnolia UI
Component/s: dialogs
Affects Version/s: 6.2.26
Fix Version/s: 6.3, 6.2.29

Type: Bug Priority: Neutral
Reporter: Roberto Gaona Assignee: Jaromir Sarf
Resolution: Fixed Votes: 0
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: 0.5d Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Issue Links:
causality
duplicate
is duplicated by MGNLUI-7711 HorizontalLayout doesn't show validat... Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MGNLUI-7777 Implementation Sub-task Completed Jaromir Sarf  
MGNLUI-7778 Code review Sub-task Completed Roman Kovařík  
MGNLUI-7779 Pre-Integration QA Sub-task Completed Roman Kovařík  
MGNLUI-7780 Final QA Sub-task Closed Sang Ngo Huu  
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:
Epic Link: FieldsMaintenance
Sprint: Nucleus 29
Story Points: 2
Team: Nucleus
Work Started:

 Description   

Steps to reproduce

  1. Create a component definition with the following dialog:
label: My Component
form:
    properties:
        multiField:
            label: My multi field
            $type: jcrMultiField
            field:
                label: ''
                $type: compositeField
                layout:
                    $type: horizontal
                itemProvider:
                    $type: jcrChildNodeProvider
                properties:
                    name:
                        $type:    textField
                        label:    Name
                        required: true
                    email:
                        label: Email
                        $type: textField
                        validators:
                            email:
                                $type:        emailValidator
                                errorMessage: Enter a valid email address  

2. Try to create the component without filling the required field or entering a non valid email.

Expected results

The error message pops up.

Actual results

The error message isn't visible.

Workaround

Development notes



 Comments   
Comment by Jaromir Sarf [ 25/Jan/23 ]

Discovery:

HorizontalLayout does not have decorated fields. The fix could be inject and use FieldComponentDecorator in createLayout method. 

For example something like this:

private final FieldComponentDecorator fieldComponentDecorator;

@Inject
protected HorizontalLayoutProducer(FieldComponentDecorator fieldComponentDecorator) {
    this.fieldComponentDecorator = fieldComponentDecorator;
}
@Override
public Component createLayout(HorizontalLayoutDefinition definition, Map<EditorPropertyDefinition, Component> mappings) {
    return new HorizontalLayout(mappings.entrySet().stream()
            .map(entry -> fieldComponentDecorator.decorateField(entry.getValue(), entry.getKey()))
            .toArray(Component[]::new));
}

In this case is also need to fix exception thrown by info.magnolia.ui.vaadin.extension.FocusFieldCaption.

Generated at Mon Feb 12 09:48:15 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.