Skip to content
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

Fix for issue with multiple server-validation errors #2444

Merged

Conversation

enkelmedia
Copy link
Contributor

Fixes issue outlined here: umbraco/Umbraco-CMS#17231

Description

This PR removes the constants used in the controller since this would prevent individual controllers for each field in a form. Before this change only one element (the last) in a form could be populated with a server validation error.

After moving/removing the constants each field not gets a unique binding and errors work as expected.

Before this change

In this example, clicking the Add server error-button will add two errors to the context - one for each field. Only the last field shows the error.

umb-validation-before

After this change

After applying the change, both of the fields show the error and resetting them by changing the value works.

umb-validation-after

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (minor updates related to the tooling or maintenance of the repository, does not impact compiled assets)

Motivation and context

How to test?

Use the provided example.

npm run example

Look in the Translation-section where there is a demo-dashboard.

Checklist

  • If my change requires a change to the documentation, I have updated the documentation in this pull request.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

@enkelmedia enkelmedia changed the title Example validation context server error Fix for issue with multiple server-validation errors Oct 10, 2024
@enkelmedia
Copy link
Contributor Author

Btw. I have a more extensive demo of using the validation context with tabs, that looks like this:

I could push this to the PR if you would like to include it as an example?

umb-validation-tab-demo

@nielslyngsoe nielslyngsoe self-requested a review October 11, 2024 12:44
@nielslyngsoe
Copy link
Member

Hi @enkelmedia, very cool. Feel free to extend the example if you think it is a good way for others to learn about the system. :-)

Please let me know when you think its ready then :-)

@enkelmedia
Copy link
Contributor Author

@nielslyngsoe I've updated the PR with the changes that you purposes and also pushed a cleaned up example with tabs.

@enkelmedia
Copy link
Contributor Author

@nielslyngsoe would be nice if you could have a look at this, let me know if you need any changes.

Copy link
Member

@nielslyngsoe nielslyngsoe left a comment

Choose a reason for hiding this comment

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

really cool, thanks

@nielslyngsoe nielslyngsoe merged commit a86f62e into umbraco:main Nov 5, 2024
8 checks passed
@umbrabot
Copy link

umbrabot commented Dec 4, 2024

Hi there @enkelmedia!

First of all: A big #H5YR for making an Umbraco related contribution during Hacktoberfest! We are very thankful for the huge amount of PRs submitted, and all the amazing work you've been doing 🥇

Due to the amazing work you and others in the community have been doing, we've had a bit of a hard time keeping up. 😅 While all of the PRs for Hacktoberfest might not have been merged yet, you still qualify for receiving some Umbraco swag, congratulations! 🎉

In the spirit of Hacktoberfest we've prepared some exclusive Umbraco swag for all our contributors - including you!
This year's swag is a custom designed notebook and custom Umbraco Hacktoberfest sticker:

image

As an alternative choice, you can opt-out of receiving anything and ask us to help improve the planet instead by planting a tree on your behalf. 🌳

Receive your swag or plant a tree! 👈 Please follow this link to fill out and submit the form, before December 25nd, 2024, 23:59:00 UTC.

Following this date we'll be sending out all the swag, but please note that it might not reach your doorstep for a few weeks/months, so please bear with us and be patient 🙏

The only thing left to say is thank you so much for participating in Hacktoberfest! We really appreciate the help!

Kind regards,
The various Umbraco teams.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants