Whether to show the browser confirmation dialog.
Readonly
contextConfigurable duration values.
When set to true
, the form will always be considered dirty.
Useful for when the user just submitted an invalid form, in which case we
consider the form to be dirty even on initial load.
Setting this to true
effectively disables the edit check, i.e. similar to
setting watchValue
to ''
and setting hasEditsValue
to true
.
Note that the confirmationValue
must still be set to true
in order for
the browser confirmation dialog to appear.
Value (state) tracking of what changes exist (comments).
Value (state) tracking of what changes exist (edits).
Optional
initialOptional
observerOptional
runningDetermines what kinds of data will be watched, defaults to edits only.
Static
blessingsStatic
outletsStatic
targetsStatic
valuesResolve the form's formData
into a comparable string without any comments
data included and other unrelated data cleaned from the value.
Include handling of File field data to determine a comparable value.
Static
shouldCheck for edits to the form with a delay based on whether the form currently has edits. If called multiple times, cancel & restart the delay timer.
Intentionally delay the check if there are already edits to the longer delay so that the UX is improved. Users are unlikely to go back to an original state of the form after making edits.
Clear the tracking changes values and messages.
Trigger the beforeunload confirmation dialog if active (confirm value is true).
Notify the user of changes to the form. Dispatch events to update the footer message via dispatching events.
When the form is submitted, ensure that the exit confirmation does not trigger. Deactivate the confirmation by setting the confirmation value to false.
Watch for comment changes, updating the timeout to match the timings for responding to page form changes.
Delay snap-shotting the form’s data to avoid race conditions with form widgets that might process the values. User interaction with the form within that delay also won’t trigger the confirmation message if they are only quickly viewing the form.
While the check
method will be triggered based on Stimulus actions (e.g. change/keyup) we also
want to account for input DOM notes entering/existing the UI and check when that happens.
Static
after
Enables the controlled form to support prompting the user when they are about to move away from the page with potentially unsaved changes.
Example: - Warn the user when there are unsaved edits
Example: - Watch comments for changes in addition to edits (default is edits only)
Example: - Force the confirmation dialog
Example: - Force the confirmation dialog without watching for edits/comments