PHPackages                             faryshta/yii2-disable-submit-buttons - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. faryshta/yii2-disable-submit-buttons

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

faryshta/yii2-disable-submit-buttons
====================================

Yii2 asset to automatically disable submit buttons on Yii2 ActiveForm.

2.0.0(7y ago)16458.9k↓25.5%10[1 issues](https://github.com/Faryshta/yii2-disable-submit-buttons/issues)BSD-3-ClausePHPPHP &gt;=5.6

Since May 10Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Faryshta/yii2-disable-submit-buttons)[ Packagist](https://packagist.org/packages/faryshta/yii2-disable-submit-buttons)[ Docs](https://github.com/Faryshta/yii2-jquery-tagsinput)[ RSS](/packages/faryshta-yii2-disable-submit-buttons/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

Faryshta Yii2 Disable Buttons
=============================

[](#faryshta-yii2-disable-buttons)

[![Latest Stable Version](https://camo.githubusercontent.com/588e30f556b0752d97e01536fb866a62462ae405729538734534eceb4a9ba94f/68747470733a2f2f706f7365722e707567782e6f72672f66617279736874612f796969322d64697361626c652d7375626d69742d627574746f6e732f762f737461626c65)](https://packagist.org/packages/faryshta/yii2-disable-submit-buttons) [![Total Downloads](https://camo.githubusercontent.com/b6923a74e01e62a7211a2da9c3d7eb6a35dd101deda1ef751b784df765f230f6/68747470733a2f2f706f7365722e707567782e6f72672f66617279736874612f796969322d64697361626c652d7375626d69742d627574746f6e732f646f776e6c6f616473)](https://packagist.org/packages/faryshta/yii2-disable-submit-buttons) [![Latest Unstable Version](https://camo.githubusercontent.com/3faa50f187e358699c43d14bb94f59ac6026c5bb7788916a8c3cf1901af3110f/68747470733a2f2f706f7365722e707567782e6f72672f66617279736874612f796969322d64697361626c652d7375626d69742d627574746f6e732f762f756e737461626c65)](https://packagist.org/packages/faryshta/yii2-disable-submit-buttons) [![License](https://camo.githubusercontent.com/5618cf3d3caf43a0d319cf28c8981324fea2e3f4c6d3e12c222c0d23205de5c6/68747470733a2f2f706f7365722e707567782e6f72672f66617279736874612f796969322d64697361626c652d7375626d69742d627574746f6e732f6c6963656e7365)](https://packagist.org/packages/faryshta/yii2-disable-submit-buttons)

Yii2 asset to automatically disable submit buttons on Yii2 [ActiveForm](http://www.yiiframework.com/doc-2.0/yii-widgets-activeform.html).

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require "faryshta/yii2-disable-submit-buttons:~2.0.0"
```

or add

```
"faryshta/yii2-disable-submit-buttons": "~2.0.0"

```

to the `require` section of your `composer.json` file.

Register Asset
--------------

[](#register-asset)

Register the `faryshta\disableSubmitButtons\Asset`, preferably on your `AppAsset` dependencies

```
use faryshta\disableSubmitButtons\Asset as DisableSubmitButtonAsset;

class AppAsset extends yii\web\AssetBundle
{
    public $depends = [
        DisableSubmitButtonsAsset::class,
        // other dependencies
    ];
}
```

Usage
-----

[](#usage)

Add css class `disable-submit-buttons` to your \[ActiveForm\] () widget.

Optionally if you want to change the text on a button, add the attribute `data-disabled-text` with the text to be changed.

```
$form = ActiveForm::begin([
    'options' => ['class' => 'disable-submit-buttons'],
    // other configurations
]);

    // inputs

    Html::submitButton('Submit', [
        // optional, will show the value of `data-disabled-text` attribute
        // while handling the validation and submit
        'data' => ['disabled-text' => 'Please Wait']
    ])

$form->end();
```

With this the `:input[type="submit"]` buttons will be disabled and if the validation fails the buttons will be enabled again.

Javascript
----------

[](#javascript)

This asset adds 2 methods on jQuery `disableSubmitButtons()` and `enableSubmitButtons()` which can be called from a `` tag generated by ActiveForm widget.

### Ajax Example

[](#ajax-example)

The following example submits the form using ajax and enables the submit buttons so the ur ser can send another form after completing the ajax request.

```
$form = ActiveForm::begin([
    'id' => 'ajax-form',
    'options' => ['class' => 'disable-submit-buttons'],
]);
    echo $form->field($model, 'name');

    echo Html::submitButton('Submit', [
        'data' => ['disabled-text' => 'Validating'],
    ]);

$form->end();

$this->registerJsFile('ajax-form.js');
```

Then on `ajax-form.js`

```
$('#ajax-form').on('beforeSubmit', function () {
  var $yiiform = $(this);
  $.ajax(
    {
      type: $yiiform.attr('method'),
      url: $yiiform.attr('action'),
      data: $yiiform.serializeArray(),
    }
  ).done(function(data) {
    // success actions
    $yiiform.enableSubmitButtons(); // enable the submit buttons
  });

  return false; // prevent default form submission
});
```

Live Demo
---------

[](#live-demo)

You can run a live demo of this library with the following composer commands

```
composer deploy-tests
composer yii serve
```

License
-------

[](#license)

The BSD License (BSD). Please see [License File](LICENSE.md) for more information.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity46

Moderate usage in the ecosystem

Community15

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 54.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~236 days

Total

3

Last Release

2823d ago

Major Versions

1.0.1 → 2.0.02018-08-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d5f64412ef020f8c137ff5c7f5e4a0866271f2f9ba9584e5a24aa48467f958d?d=identicon)[Faryshta](/maintainers/Faryshta)

---

Top Contributors

[![Faryshta](https://avatars.githubusercontent.com/u/2029247?v=4)](https://github.com/Faryshta "Faryshta (6 commits)")[![ayrozjlc](https://avatars.githubusercontent.com/u/10901620?v=4)](https://github.com/ayrozjlc "ayrozjlc (3 commits)")[![omar-mostro](https://avatars.githubusercontent.com/u/8531363?v=4)](https://github.com/omar-mostro "omar-mostro (1 commits)")[![Sensetivity](https://avatars.githubusercontent.com/u/4289543?v=4)](https://github.com/Sensetivity "Sensetivity (1 commits)")

---

Tags

jqueryyii2yiidisableactiveform

### Embed Badge

![Health badge](/badges/faryshta-yii2-disable-submit-buttons/health.svg)

```
[![Health](https://phpackages.com/badges/faryshta-yii2-disable-submit-buttons/health.svg)](https://phpackages.com/packages/faryshta-yii2-disable-submit-buttons)
```

###  Alternatives

[nullref/yii2-datatables

Yii2 Extension for DataTables jQuery plug-in

7290.3k](/packages/nullref-yii2-datatables)[brussens/yii2-maintenance-mode

Maintenance mode component for Yii framework 2.x.x version.

78256.3k5](/packages/brussens-yii2-maintenance-mode)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
