Skip to content

fix: Error Messages Not Displayed for Nested Array Fields in Form Inputs#324

Merged
markstory merged 2 commits into
cakephp:4.xfrom
ryu818:fix/issue323/nested_error_mes
Dec 7, 2024
Merged

fix: Error Messages Not Displayed for Nested Array Fields in Form Inputs#324
markstory merged 2 commits into
cakephp:4.xfrom
ryu818:fix/issue323/nested_error_mes

Conversation

@ryu818
Copy link
Copy Markdown
Contributor

@ryu818 ryu818 commented Nov 27, 2024

Comment thread src/View/Form/DocumentContext.php Outdated
}

if (!$errors && $entityErrors && !is_array($entity)) {
if (!$errors && $entityErrors) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, we'll need to get some tests added before we can merge this though. This class has some existing tests https://github.com/cakephp/elastic-search/blob/4.x/tests/TestCase/View/Form/DocumentContextTest.php

I'm happy to help if you need a hand.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unable to set up the test environment, so adding test code is difficult. Could you please assist me with this?

I believe the issue can be reproduced by specifying the following data in new Article and triggering the corresponding error:

{
  "name": {
    "ja": [
      {
        "family_name": "XX",
        "given_name": "XX"
      }
    ],
    "en": [
      {
        "family_name": "XX",
        "given_name": "XXX"
      }
    ]
  }
}

@markstory markstory merged commit f474c62 into cakephp:4.x Dec 7, 2024
@markstory
Copy link
Copy Markdown
Member

Thank you 🎉

@ryu818 ryu818 deleted the fix/issue323/nested_error_mes branch April 3, 2025 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants