[MGNLUI-8383] Trigger validating on changed field of subform on another language Created: 26/Sep/23  Updated: 16/Nov/23  Resolved: 23/Oct/23

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

Type: Bug Priority: Neutral
Reporter: Quach Hao Thien Assignee: Jaromir Sarf
Resolution: Fixed Votes: 0
Labels: VN-Analysis, VN-Maintenance
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: 6d 1h Time Spent: 6d 1h
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Issue Links:
Relates
relates to MGNLUI-6918 Switchable Field i18n validation error Closed
relation
is related to MGNLUI-8286 Dialog does not switch languages to s... Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MGNLUI-8384 Implementation Sub-task Completed Quach Hao Thien  
MGNLUI-8385 Review Sub-task Completed Antonín Juran  
MGNLUI-8386 Pre-Integration QA Sub-task Closed Antonín Juran  
MGNLUI-8387 QA 6.2 Sub-task Completed Jaromir Sarf  
MGNLUI-8422 DOC: Describe interaction between req... Sub-task Closed Adrian Brooks  
MGNLUI-8466 Preintqa 6.3 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:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Sprint: Nucleus 47
Story Points: 3
Team: Nucleus
Work Started:
Approved:
Yes

 Description   

Steps to reproduce:

  1. Decorate a pages component e.g: textImage.yaml
form:
  properties:
    link:
      $type: switchableField
      i18n: true
      field:
        $type: radioButtonGroupField
        layout: horizontal
        defaultValue: internal
        datasource:
          $type: optionListDatasource
          options:
            - name: internal
              value: internal
            - name: external
              value: external
      itemProvider:
        $type: jcrChildNodeProvider
      forms:
        - name: internal
          properties:
            internal:
              label: brz-site-base.dialogs.base.link.options.internal
              $type: pageLinkField
              required: true
              buttonSelectNewLabel: standardButtons.buttonSelectNewLabel
        - name: external
          properties:
            external:
              label: brz-site-base.dialogs.base.link.options.external
              $type: textField
              required: true
  layout: !override
    $type: tabbedLayout
    tabs: !override
      - name: tabText
        fields: !override
          - name: link
      - name: tabImage
        fields:
  1. Add the component to a multi languages site, e.g: travel page
  2. Fulfil all required fields of the switchable field on every language subform, e.g: de, en; and then save the component
  3. Open the component again and delete value of one required field in subform, then switch to the other language and then save the component

Expect result:

  • The component cannot be saved and
  • Switch to the locale that contains the invalid field

    Actual result:

The component is saved without any warning



 Comments   
Comment by Quach Hao Thien [ 27/Sep/23 ]

Discovery

When the subform is being checked whether any change is found on i18n field, the field is filtered out because it cannot prove itself as i18n field since the i18n identity is defined in the parent field, which is the switchableField.

Possible Solution:

  • Improve the filter to i18n-check against the main field (switchableField in this case) instead of the field of subForm
  • In MGNLUI-6918, the parent locale context was introduced, use this context when possible (it can be null) to handle switching to other locales that contain invalid fields instead of this, e.g.: 
localeContext.parentContext().value().orElse(localeContext).current().set(locale); 

Note: 

Same issue with MGNLUI-8286

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