ayrozjlc/yii2-disable-submit-form

Yii2 asset to automatically disable submit form on Yii2 ActiveForm.

Installs: 365

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:JavaScript

Type:yii2-extension

v1.0.0 2020-09-03 10:13 UTC

This package is auto-updated.

Last update: 2024-10-13 18:30:38 UTC


README

Yii2 asset to automatically disable submit buttons on Yii2 ActiveForm.

Installation

The preferred way to install this extension is through composer.

Either run

composer require --prefer-dist "ayrozjlc/yii2-disable-submit-form:*"

or add

"ayrozjlc/yii2-disable-submit-form": "*"

to the require section of your composer.json file.

Register Asset

Register the ayrozjlc\disablesubmit\DisableSubmitFormAsset, preferably on your AppAsset dependencies

class AppAsset extends yii\web\AssetBundle
{
    public $depends = [
        'ayrozjlc\disablesubmit\DisableSubmitFormAsset',
        // other dependencies
    ];
}

or add in view

// ...
use ayrozjlc\disablesubmit\DisableSubmitFormAsset;
// ...
DisableSubmitFormAsset::register($this);

Usage

add in view

$customScript = "
$('#id-form').disableForm({
    disabled_text : 'message',
	// block : true // to activate plugin blockui
	// block_div : '#element' // by default it is applied to the parent element of the form
});";
$this->registerJs($customScript, \yii\web\View::POS_READY);