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

[5.x] Handle required fields when adding entries to nav #10468

Merged

Conversation

duncanmcclean
Copy link
Member

@duncanmcclean duncanmcclean commented Jul 17, 2024

This pull request makes some improvements around the handling of required fields in Navigation blueprints.

Currently, when you select entries to add to a navigation, you'll be able to get away without filling any required fields.

With this PR, you'll only be able to select a single entry at a time. After selecting, you'll be taken to the "Edit Page" stack where you'll be able to fill the required field.

Fixes #4582.

@duncanmcclean duncanmcclean marked this pull request as draft July 17, 2024 18:45
@duncanmcclean duncanmcclean marked this pull request as ready for review July 17, 2024 19:32
Copy link
Member

@jasonvarga jasonvarga left a comment

Choose a reason for hiding this comment

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

When you don't have any required fields, you can no longer add entries at all. Clicking the dropdown item does nothing and outputs a JS error.

It works when you do have a required field.

Returning `null` seems to cause an issue with the `<relationship-input>` component, where as returning nothing or undefined seems to work fine.
Returning `null` seems to cause an issue with the `<relationship-input>` component, where as returning nothing or undefined seems to work fine.
… of github.com:statamic/cms into handle-required-validation-when-adding-entries-to-navs
@duncanmcclean
Copy link
Member Author

When you don't have any required fields, you can no longer add entries at all. Clicking the dropdown item does nothing and outputs a JS error.

It works when you do have a required field.

Good catch, should be sorted now!

Copy link
Member

@jasonvarga jasonvarga left a comment

Choose a reason for hiding this comment

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

That's fixed, thanks.

But now I'm noticing that when you don't have any required fields, and you pick a single entry, the editor pops up.

@jasonvarga jasonvarga merged commit ed1d8f4 into 5.x Jul 18, 2024
15 checks passed
@jasonvarga jasonvarga deleted the handle-required-validation-when-adding-entries-to-navs branch July 18, 2024 18:22
@robdekort
Copy link
Contributor

So much stuff being tackled and added all the time. ❤️

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.

Navigation blueprint: validation doesn't kick in
3 participants