2017 © Pedro Peláez
 

yii2-extension yii2-ajaxform

Provides AJAX submission for yii2 ActiveForm

image

jwaldock/yii2-ajaxform

Provides AJAX submission for yii2 ActiveForm

  • Wednesday, June 29, 2016
  • by jwaldock
  • Repository
  • 2 Watchers
  • 1 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

ActiveForm AJAX Save Widget

Provides AJAX save for yii2 ActiveForm, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Add, (*3)

"repositories":[
    {
        "type": "git",
        "url": "https://github.com/jwaldock/yii2-ajaxform"
        "url": "https://path.to/your/repo"
    }
]

to your composer.json file., (*4)

Either run, (*5)

php composer.phar require jwaldock/yii2-ajaxform:dev-master

or add., (*6)

"jwaldock/yii2-ajaxform": "dev-master"
"repositories":[
    {
        "type": "git",
        "url": "https://path.to/your/repo"
    }
]

to your composer.json file., (*7)

Either run, (*8)

php composer.phar require jwaldock/yii2-ajaxform:dev-master

or add., (*9)

"jwaldock/yii2-ajaxform": "dev-master"

to the require section of your composer.json file, (*10)

Usage

Set up AJAX validation for your, (*11)

yiiAjaxForm provides three events submitBegin, submitEnd and submitFailed. Event handlers for these events should have the following function signatures:, (*12)

// 'submitBegin' event
function (event) {
    // handle submission begin
}
// 'submitEnd' event
function (event, success, modeldata) {
    if (success) {
        // handle successful save
        return
    }
    // handle failed save
}
// submitFailed
function (event, xhr) {
    // handle failure
}
public function actions()
{
   return [
       'submit-model' => [
           'class' => 'jwaldock\ajaxform\AjaxSubmitAction',
           'modelClass' => 'model', // the fully qualified class name of the model  
           'tabular' => true, // set to true if using a tabular form - defaults to false
           'scenario' => 'model-scenario' // optional model scenario
       ],
       // other actions
   ];
}
 $form, // ActiveForm
    'disableSubmit' => true, // whether to disable the submit button on submitting the form
    'savingContent' => 'Saving...', the inner html content of the submit button when saving
    'clientEvents' => [
        'submitEnd' => $js,
    ],
]);
?>

The Versions

29/06 2016

dev-master

9999999-dev

Provides AJAX submission for yii2 ActiveForm

  Sources   Download

BSD-3-Clause

The Requires

 

by Joel Waldock

extension yii2 form ajax activeform