Skip to main content

DetectDirtyFormController

Purpose

Track whether any of the inputs elements of a <form> have changed their value from the value they loaded with.

Adds data-dirty to any inputs being watched that change value, and removes data-dirty if it returns to its initial value.

Adds data-dirty to the form if any of the child inputs are different to the value they loaded with, and removes it when all elements are returned to their initial values.

Actions

ActionPurpose
restoreReturn the form and all inputs to their original value

Targets

TargetPurposeDefault
---

Classes

ClassPurposeDefault
---

Values

ValueTypeDescriptionDefault
----

Events

EventWhenDispatched onevent.detail
input-dirtied-the input, textarea or select that changedtarget: the input that changed
input-cleaned-the input, textarea or select that changedtarget: the input that changed
form-dirtied-the form that changedtarget: the form that changed
form-cleaned-the form that changedtarget: the form that changed

Side Effects

Adds input and change event listeners to the attached form, bubbled up from any child inputs.

How to Use