-
Notifications
You must be signed in to change notification settings - Fork 111
Mark all parent accordions/tabs if validation exception of control inside #1835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 5 commits
621d33f
70d6bde
39fb4b4
7ae4051
4fac97a
14bf730
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -258,8 +258,16 @@ public function onSubmit(\Closure $callback) | |
| return $response; | ||
| } catch (ValidationException $e) { | ||
| $response = []; | ||
| $openFirstSectionOnError = false; | ||
|
|
||
| foreach ($e->errors as $field => $error) { | ||
| $response[] = $this->error($field, $error); | ||
|
|
||
| // If field inside Accordion section does not validate, open first AccordionSection | ||
| if (!$openFirstSectionOnError && $this->getControl($field)->getOwner()->getOwner() instanceof \Atk4\Ui\AccordionSection) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this smells to me - also, ideally it should not be handled in also Behat test should be added, so this code is covered - otherwise the logic might break soon - once you will satisfy all CI tests, you should see this in CodeCov report
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. getOwner multiple times also is used in other view, like Crud. You are right, nested Accordions are then not supported - but since today it just won't work at all, this is a huge improvement to usability. And to me, nested Accordions in forms really is an edge case which would not be priority to me to support yet. |
||
| $response[] = $this->getControl($field)->getOwner()->getOwner()->getOwner()->jsOpen($this->getControl($field)->getOwner()->getOwner()); | ||
| $openFirstSectionOnError = true; | ||
| } | ||
| } | ||
|
|
||
| return $response; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.