[MGNLUI-6406] Complex fields doesn't allow validators config anymore Created: 13/Nov/20  Updated: 12/Oct/23  Resolved: 06/Apr/22

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: 6.2.4
Fix Version/s: None

Type: Epic Priority: Urgent
Reporter: Jonathan Ayala Assignee: Unassigned
Resolution: Workaround exists Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: 0d
Original Estimate: Not Specified

Issue Links:
Relates
relates to MGNLUI-6485 Link field validation is not possible Accepted
causality
Template:
Epic Name: formLevelValidation
Acceptance criteria:
Empty
Date of First Response:
Parent Link: MGNLUI-6621M6 UI Framework

 Description   

Validators configuration is not posible for new 6UI complex fields such as info.magnolia.ui.field.MultiFieldDefinition and info.magnolia.ui.field.CompositeFieldDefinition. In 5UI they extend info.magnolia.ui.form.field.definition.ConfiguredFieldDefinition, which allows the usage of validators whereas in 6UI, they extend info.magnolia.ui.field.ConfiguredComplexPropertyDefinition, which does not contain the validators attribute.

This is a problem for customers migrating forms to 6 UI which contain validators for such fields.



 Comments   
Comment by Richard Gange [ 30/Dec/20 ]

This is a problem for customers migrating forms to 6 UI which contain validators for such fields.

I think in a lot of cases there might be another approach which could achieve the same goals without validation. Perhaps a different type of field with a configuration that prevents the need to even evaluate (for example MGNLUI-6485). Customers willing to change the design should ask support or comment for workaround ideas.

Comment by Mariusz Chruscielewski [ 01/Feb/21 ]

I think a lot of people who upgrade, have already some data sets used on production, changing field type is not always possible. In our case we have a lot of multivalue fields that contain Select fields, but those select fields are custom, and they load (lazy) from database while typing. There is no other way to validate if this set contains duplicates, but use validator on multivalue field. 

Comment by Roman Kovařík [ 01/Jul/21 ]

Multi field validators use cases from linked support tickets/ comments:

  • Min/max entries MGNLUI-3527
  • Uniqueness of items
    • Should validator be responsible for this or rather a field should not allow this (MGNLUI-6763MGNLUI-3197)?
      • As the same datasource can be used for different select/link fields, this is more flexible then creating custom fields in M5
  • Please comment with other use cases to justify the need for such API.

Problems with exposing validator API on multi fields:

  • Complex field in M6 framework is just a set of sub forms, unlike in M5, where everything was converted to an intermediate representation (PropertySetItem).
  • As the subform can be a complex field as well, there is no direct access to a field value (there could be just a static field or a layout).

 
 

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