2018-10-15 09:36:19 -04:00
|
|
|
# Dirty Submit
|
|
|
|
|
2020-02-06 10:09:11 -05:00
|
|
|
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/21115) in GitLab 11.3.
|
2018-10-15 09:36:19 -04:00
|
|
|
|
|
|
|
## Summary
|
|
|
|
|
|
|
|
Prevent submitting forms with no changes.
|
|
|
|
|
|
|
|
Currently handles `input`, `textarea` and `select` elements.
|
|
|
|
|
2019-09-18 14:06:14 -04:00
|
|
|
Also, see [the code](https://gitlab.com/gitlab-org/gitlab/blob/master/app/assets/javascripts/dirty_submit/)
|
2019-08-19 19:41:23 -04:00
|
|
|
within the GitLab project.
|
|
|
|
|
2018-10-15 09:36:19 -04:00
|
|
|
## Usage
|
|
|
|
|
2020-05-19 14:08:11 -04:00
|
|
|
```javascript
|
2018-10-15 09:36:19 -04:00
|
|
|
import dirtySubmitFactory from './dirty_submit/dirty_submit_form';
|
|
|
|
|
|
|
|
new DirtySubmitForm(document.querySelector('form'));
|
|
|
|
// or
|
|
|
|
new DirtySubmitForm(document.querySelectorAll('form'));
|
|
|
|
```
|