定制 jwaldock/yii2-ajaxform 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jwaldock/yii2-ajaxform

Composer 安装命令:

composer require jwaldock/yii2-ajaxform

包简介

Provides AJAX submission for yii2 ActiveForm

README 文档

README

Provides AJAX save for yii2 ActiveForm

Installation

The preferred way to install this extension is through composer.

Add

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

to your composer.json file.

Either run

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

or add.

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

to your composer.json file.

Either run

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

or add.

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

to the require section of your composer.json file

Usage

Set up AJAX validation for your

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

// '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
   ];
}
<?php 
$js = <<<JS
function (event, success, modeldata)  {
    if (success) {
        // handle successful save
    }
}
JS;

AjaxFormWidget::widget([
    'form' => $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,
    ],
]);
?>

统计信息

  • 总下载量: 183
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2016-05-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固