[MGNLUI-6918] Switchable Field i18n validation error Created: 19/Oct/21  Updated: 18/Oct/23  Resolved: 26/Sep/23

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: 6.2.12
Fix Version/s: 6.3.0, 6.2.40

Type: Bug Priority: Neutral
Reporter: Carlos Cantalapiedra Assignee: Quach Hao Thien
Resolution: Fixed Votes: 0
Labels: VN-Maintenance
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: 6d 3.5h Time Spent: 6d 3.5h
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Issue Links:
Cloners
is cloned by MGNLUI-8426 Switchable Field i18n validation error Closed
Problem/Incident
Relates
relates to MGNLUI-8383 Trigger validating on changed field o... Closed
relates to MGNLUI-8378 Write regression test for MGNLUI-6918 Closed
dependency
is depended upon by MGNLUI-8286 Dialog does not switch languages to s... Closed
duplicate
duplicates MGNLUI-6830 No visual feedback on field validatio... Closed
relation
is related to MGNLUI-8426 Switchable Field i18n validation error Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MGNLUI-8369 Implementation Sub-task Completed Quach Hao Thien  
MGNLUI-8370 Review Sub-task Completed Adam Siska  
MGNLUI-8371 PreintQA Sub-task Completed Adam Siska  
MGNLUI-8372 QA Sub-task Closed Antonín Juran  
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
Release notes required:
Yes
Date of First Response:
Sprint: Nucleus 45, Nucleus 46
Story Points: 5
Team: Nucleus
Work Started:
Approved:
Yes

 Description   

Steps to reproduce

  1.  Define a component as the following
    form:
      properties:
        - name: text
          i18n: true
          $type: textField
        - name: switchMe
          $type: switchableField
          i18n: true
          field:
            $type: radioButtonGroupField
            required: true
            layout: horizontal
            defaultValue: internal
            datasource:
              $type: optionListDatasource
              options:
                - name: internal
                  value: internal
                - name: external
                  value: external
          itemProvider:
            $type: jcrChildNodeProvider
          forms:
            - name: internal
              properties:
                internal:
                  $type: pageLinkField
                  required: true
            - name: external
              properties:
                external:
                  $type: textField
                  required: true 
  1.  Create it on a site which has multiple languages enabled
  2. Switch to locale which is not default one
  3. Select one option on switchMe field
  4. Clic on submit
  5. Check the dialog doesn't close but no error is shown
  6. Move to other language and check the error of required field is printed

Expected results

Some kind of advice is shown to let the editor know he must fulfill the switchMe field for all languages as far as it is required

Actual results

The error is shown only if the editor switch to other language

Workaround

N/A

Development notes

N/A



 Comments   
Comment by Roberto Gaona [ 21/Oct/21 ]

This issue duplicates MGNLUI-6830. Marking it as duplicated.

Comment by Quach Hao Thien [ 19/Sep/23 ]

Discovery (new finding)

When applying defaultValue for subEditors, a new subEditor is created using default locale as restricted (in this case is en), and we have a new LocaleContext [LocaleContext (default: en, current: en, availableLocales \{en})] https://git.magnolia-cms.com/projects/platform/repos/ui/browse/magnolia-ui-framework/src/main/java/info/magnolia/ui/editor/FormView.java?at=65688c755920d2228387c3b9013be23977a24757#176

When that subEditor is validating, the LocaleContext of that subEditor will be used to check the current locale for validating https://git.magnolia-cms.com/projects/PLATFORM/repos/ui/browse/magnolia-ui-framework/src/main/java/info/magnolia/ui/editor/FormPresenter.java?at=refs%2Fheads%2Frelease%2F6.2#172, and that somehow breaks the validating logic because the en locale is not the selected locale

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