Skip to content

Alerts for external validation errors in ObjectBrowserWidget #6827

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

alexandreIFB
Copy link
Contributor

@alexandreIFB alexandreIFB commented Mar 11, 2025

Solution

To solve this problem, I combine this.state.errors (internal errors) with this.props.error (external errors) before passing them to the FormFieldWrapper.

Testing Instructions

To simulate the issue and verify the fix:

Save Teaser without providing Target ( href).

Closes #6787

Copy link

netlify bot commented Mar 11, 2025

Deploy Preview for plone-components canceled.

Name Link
🔨 Latest commit a88e8f2
🔍 Latest deploy log https://app.netlify.com/sites/plone-components/deploys/67d04d0c0718fb0008b0d7cc

@alexandreIFB
Copy link
Contributor Author

@wesleybl

Copy link

netlify bot commented Mar 11, 2025

Deploy Preview for plone-components canceled.

Name Link
🔨 Latest commit 5d751f0
🔍 Latest deploy log https://app.netlify.com/sites/plone-components/deploys/67d04d186fd63500085a0dee

@wesleybl
Copy link
Member

@alexandreIFB we already have a suggested fix for this issue at: #6810

Can you please take a look there?

@@ -354,8 +366,7 @@ export class ObjectBrowserWidgetComponent extends Component {
return (
<FormFieldWrapper
{...this.props}
// At the moment, OBW handles its own errors and validation
Copy link
Member

Choose a reason for hiding this comment

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

@sneridagh What did you mean by this comment? With this fix, can it be removed?

Copy link
Member

Choose a reason for hiding this comment

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

I can't remember now why did I write this. Probably I tried and failed, are we sure it covers all the use cases?
Can we have Cypress tests with a battery of use cases?

Copy link
Member

Choose a reason for hiding this comment

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

I can't remember now why did I write this.

@sneridagh Well, if you don't remember, it's better to remove the comment. It will confuse more than explain. lol

Probably I tried and failed, are we sure it covers all the use cases? Can we have Cypress tests with a battery of use cases?

This PR is for displaying the error message in ObjectBrowserWidget. We have tested other widgets and they display the error message. Only ObjectBrowserWidget does not display it. @alexandreIFB can do a test for ObjectBrowserWidget.

Copy link
Member

@wesleybl wesleybl left a comment

Choose a reason for hiding this comment

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

I can confirm that these changes fix the issue.

Thanks!

@wesleybl wesleybl requested a review from davisagli March 13, 2025 12:59
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.

display field form errors in ObjectBrowserWidget.
3 participants