gitlab-org--gitlab-foss/doc/development/new_fe_guide/modules/dirty_submit.md

23 lines
578 B
Markdown
Raw Normal View History

# Dirty Submit
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/21115) in GitLab 11.3.
## Summary
Prevent submitting forms with no changes.
Currently handles `input`, `textarea` and `select` elements.
Also, see [the code](https://gitlab.com/gitlab-org/gitlab/blob/master/app/assets/javascripts/dirty_submit/)
within the GitLab project.
## Usage
```javascript
import dirtySubmitFactory from './dirty_submit/dirty_submit_form';
new DirtySubmitForm(document.querySelector('form'));
// or
new DirtySubmitForm(document.querySelectorAll('form'));
```