# disable-form-on-submit

> JavaScript plugin that disables a form after a submit is attempted. Good for preventing double clicking causing double submits.

Latest version **2.0.0** (published 2023-11-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install disable-form-on-submit
pnpm add disable-form-on-submit
yarn add disable-form-on-submit
bun add disable-form-on-submit
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2023-11-16 |
| First published | 2019-03-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 18.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Strut Tower |
| Maintainers | struttower |

## Links

- npm: https://www.npmjs.com/package/disable-form-on-submit
- Repository: https://github.com/StrutTower/disable-form-on-submit
- Issues: https://github.com/StrutTower/disable-form-on-submit/issues
- npm.io page: https://npm.io/package/disable-form-on-submit

## Recent versions

- 2.0.0 (latest) — 2023-11-16
- 1.0.1 — 2019-10-25
- 1.0.0 — 2019-03-19

## README

# Disable Form on Submit

JavaScript plug-in that can disable a from for a specific amount of time after a submit is attempted.
Great for preventing users from double clicking on the submit button and submitting the form twice.

[Live Demo](https://struttower.github.io/disable-form-on-submit/demo/demo.html)

## Usage

Basic usage with default options:
```javascript
new disableFormOnSubmit(formElement);
```



With Options:
```javascript
new disableFormOnSubmit(formElement, {
    duration: 4000,
    buttonTemplate: 'Please Wait...',
    submitInputText: 'Please Wait...'
});
```


## Options


| Option | Description |
|:------:|-------------|
| duration | Time that the form is disabled in milliseconds. Default: 4000 |
| buttonTemplate | HTML that will replace the content of any submit buttons while the form is disabled. false will disable the replacement. Default: `'Please Wait...'` |
| submitInputText | Text that will replace the value of any submit inputs while the form is disabled. false will disable the replacement. Default: `'Please Wait...'`

### Override the duration on a specific form

If your are using a selector that selects multiple forms the duration can be overriden on a specific form by adding a 
`data-disable-duration` attribute to the form:

```html
<form action="" method="" data-disable-duration="2000">
```


### Disable on a specific form using data attributes
```html
<form action="" method="" data-disable-duration="false">
```

---
_Source: https://npm.io/package/disable-form-on-submit · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
