How to manager dirty forms

I would like to manage the “dirty” state of a form - ie if any data has changed since it was last saved, or the form opened. I tried to use a variable in the form, and then use a dynamic event when the input changed to set this to true, and then use this to change the disabled state of a button, but this doesn’t seem to work (the button stays enabled).

Ultimately, I would like to also stop someone closing a modal while the form is dirty - or at least pop up an “are you sure” box.

Can someone suggest how this could be achieved.

Thanks.

Community Page
Last updated: