Use cases for <form method="dialog">

submited by
Style Pass
2025-01-15 11:30:05

I've started using a relatively less known value of the <form> element's method attribute, called dialog, for the following scenarios:

When the form is inside a <dialog>, closes the dialog and causes a submit event to be fired on submission, without submitting data or clearing the form.

But the HTML spec, having been written in officialese and being the more authoritative source than MDN, provides a nice escape hatch.

Indicates the form is intended to close the dialog box in which the form finds itself, if any, and otherwise not submit.

Leave a Comment
Related Posts