Display validation errors in dialogs that create sections
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3503547. -->
Reported by: [wim leers](https://www.drupal.org/user/99777)
>>>
<h3 id="overview">Overview</h3>
<p><span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/experience_builder/issues/3499947" title="Status: Closed (fixed)">#3499947: Managing code components in library</a></span> made it possible to create new code components in the UI, atop the HTTP API that <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/experience_builder/issues/3499931" title="Status: Closed (fixed)">#3499931: HTTP API for code component config entities</a></span> provides 🤩 It's <em>really</em> cool to see in action!</p>
<p>Invalid user input <em>will</em> result in the appropriate <code>422</code> response with the corresponding validation errors. But the UI does not present those errors:</p>
<p><img src="https://www.drupal.org/files/issues/2025-01-31/Screenshot%202025-01-31%20at%2010.58.32%20AM.png" alt=""></p>
<h3 id="proposed-resolution">Proposed resolution</h3>
<ol>
<li>Display detailed errors throughout the code component dialogs, perhaps generic, perhaps only for 422 responses that contain <code>{"errors": {"0": {"details": "…", "source": "…"}, {"1": … }}</code>.</li>
<li>Bonus: use <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern">the <code>pattern</code></a> attribute for providing client-side validation, to make the user immediately aware? 🤓</li>
</ol>
<h3 id="ui-changes">User interface changes</h3>
<p>Validation errors are presented to the user.</p>
> Related issue: [Issue #3499947](https://www.drupal.org/node/3499947)
> Related issue: [Issue #3502640](https://www.drupal.org/node/3502640)
> Related issue: [Issue #3504366](https://www.drupal.org/node/3504366)
> Related issue: [Issue #3504434](https://www.drupal.org/node/3504434)
> Related issue: [Issue #3509608](https://www.drupal.org/node/3509608)
> Related issue: [Issue #3514035](https://www.drupal.org/node/3514035)
> Related issue: [Issue #3520071](https://www.drupal.org/node/3520071)
> Related issue: [Issue #3523462](https://www.drupal.org/node/3523462)
issue