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

Abort confirmation modal flow if attached form is invalid #2253

Merged

Conversation

niklasmohrin
Copy link
Member

Otherwise, the modal would just close without anything happening.

This first came up at #2050 (comment).

One problem that could occur is that there is an invalid input present, but outside of the modal, so it is hard to tell what is wrong. Optimally, the modal confirm button could then display a message like "there are form errors outside of this modal".

Since we currently only have one occurrence of setCustomValidity, there should be no problems with this new behavior of the modal for the existing modals.

@niklasmohrin
Copy link
Member Author

niklasmohrin commented Jul 29, 2024

Actually, there is an easier way, which is already used for semester deletion: Overwrite the submit-group slot and specify a new submit button - this button is then attached to the outer form, not the form that triggers the submit handler of the dialogForm of the modal. I wonder if that approach is universally better or whether we should change the semester deletion modal to this new pattern instead

Copy link
Member

@richardebeling richardebeling left a comment

Choose a reason for hiding this comment

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

Code is fine with me.

Overwrite the submit-group slot and specify a new submit button - this button is then attached to the outer form, not the form that triggers the submit handler of the dialogForm of the modal. I wonder if that approach is universally better or whether we should change the semester deletion modal to this new pattern instead

I have no clue. Both approaches sound reasonable to me, I think you can judge this better.

@niklasmohrin niklasmohrin force-pushed the confirmation-modal-report-validity branch from a905233 to 3b4c1e2 Compare August 12, 2024 16:09
@niklasmohrin niklasmohrin merged commit a8b0f2f into e-valuation:main Aug 12, 2024
12 checks passed
@niklasmohrin niklasmohrin deleted the confirmation-modal-report-validity branch August 12, 2024 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants