Problem/Motivation
When using the InlineEntityFormSimple or InlineEntityFormComplex widget, site administrators can determine whether the details item that contains the IEF widget is collapsed or expanded by default.
This behavior is respected when the form is rendered for the 1st time and works as expected.
However, if the form validation fails after submitting the form, all the IEF widgets appears as expanded, even if their fields were correct.
In situations where there are multiple IEF widgets at the same time in the page, this behavior can be confusing.
Our expected behavior is that only IEF widgets whose validation failed should be always open, but the rest, should respect the widget settings.
This is related and inspired by #2894213: Ensure visibility of invalid fields (serverside)
Steps to reproduce
- Create an entity with multiple IEF widgets (all of them set aas collapsed by default)
- Go to the entity creation form and observe that all the widgets are collapsed
- Force to fail validation of any of the fields and click on the form's "Sve" button
- Validation fails, and the form is reloaded. However all the IEF widgets are expanded
Proposed resolution
Add logic to respect the expand/collapse desired logic after form validations fails.
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
Issue fork inline_entity_form-3284647
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
plopescUpdate status.
Comment #4
geek-merlinThanks for raising this and providing a MR! I have no time currently to manually test this.
Does the MR fix the issue for you?
Can you extend one of the existing tests to cover the problem you described?
Comment #5
plopescHello, thank you for your answer.
Yes, this patch solved the issue for us and it has been in a live project since then.
I will try to find a chance to write a test for this.
Comment #6
podarokComment #8
plopescUpdate branch
Comment #10
plopescCreated new MR against 3.x