Submit forms in dialogs

2023-02-20 / mgrubinger / 0 reactions

If you’re using a <form> element inside a <dialog> element, you might want to consider setting its method attribute to dialog.

This will cause the dialog to close automatically on form submission and set the value of the submit button to dialog.returnValue. It will not actually submit the form though.

More details:

I learned about this from Dominik Reitz ner at the Svelte Vienna Meetup.

Leave a reaction if you liked this post! 🧡
Leave a new comment