[MGNLUI-3625] SwitchableField should only validate selected field Created: 15/Oct/15  Updated: 02/Oct/20  Resolved: 02/Nov/15

Status: Closed
Project: Magnolia UI
Component/s: dialogs, forms
Affects Version/s: None
Fix Version/s: 5.4.3

Type: Bug Priority: Major
Reporter: Federico Grilli Assignee: Federico Grilli
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: 0d
Time Spent: 7.25h
Original Estimate: Not Specified

Issue Links:
Relates
relates to MGNLUI-6236 Validation triggers on non-active/not... Closed
causality
dependency
depends upon MGNLUI-3313 Improve validation capabilities of th... Closed
is depended upon by MGNLDEMO-92 Demo of video component (from dam) Closed
relation
is related to MGNLUI-6263 SwitchableField should only validate ... Closed
supersession
supersedes MGNLUI-3619 SwitchableFieldDefinition does not cl... Closed
supersedes MGNLUI-2712 info.magnolia.ui.form.field.definitio... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Sprint: Basel 17
Story Points: 2

 Description   

Suppose you have a form with a radio button enabling to choose between a text field and a rich text field. Both fields are required. User selects and fills in the former but upon saving a validation error will occur complaining that the field not selected is required.



 Comments   
Comment by Mikaël Geljić [ 19/Oct/15 ]

Linking to MGNLUI-3313 just for the sake of completeness. It defines behavior when required is set on the complex-field itself.

Comment by Mikaël Geljić [ 23/Oct/15 ]

To reiterate here: I'm puzzled about fixing validation in the SwitchableField properly, without fixing its super-class AbstractCustomMultiField. It's because of it that we can't benefit from default behavior for validate(), isEmpty() or getErrorMessage().

I contributed a semi-ugly patch to the PR (again, because of the AbstractCustomMultiField poor implementation, I had to replicate isValid(), and getErrorMessage from Vaadin's AbstractField).

Now, since MGNLUI-3313 is scheduled for 5.3.12, I would like to park this ticket for now and address the proper fixes in AbstractCustomMultiField before (unless it takes more time than we have before 5.4.3). Only then I could remove the ugly parts from my patch here.

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