summaryrefslogtreecommitdiff
path: root/doc/development/new_fe_guide/modules/dirty_submit.md
blob: 17cdab3f240d0d52db5f0f47c16dd73ec91ccfa5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---

# 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'));
```