Adding a modal to a page differs a little compared to adding a global modal to the Layout. Github Example
For forms in modals, it's better to also output validation errors in the flash message. Otherwise, the user may miss the error when the modal closes. Github Example