This example demonstrates a form that can work as a normal multi-request form, or as a modal dialog using AJAX.
In order to show a modal dialog by clicking on a link, that link has to have class use-ajax and data-dialog-type="modal". This link has those attributes.
See this form as a modal.