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