2018-12-13 13:39:08 +05:30
|
|
|
# Dirty Submit
|
|
|
|
|
2020-03-09 13:42:32 +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-21 20:55:43 +05:30
|
|
|
Also, see [the code](https://gitlab.com/gitlab-org/gitlab/blob/master/app/assets/javascripts/dirty_submit/)
|
2019-12-04 20:38:33 +05:30
|
|
|
within the GitLab project.
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
## Usage
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
```javascript
|
2018-12-13 13:39:08 +05:30
|
|
|
import dirtySubmitFactory from './dirty_submit/dirty_submit_form';
|
|
|
|
|
|
|
|
new DirtySubmitForm(document.querySelector('form'));
|
|
|
|
// or
|
|
|
|
new DirtySubmitForm(document.querySelectorAll('form'));
|
|
|
|
```
|