Skip to content

Commit

Permalink
Merge pull request yiisoft#12747 from werew01f/master
Browse files Browse the repository at this point in the history
afterInit event for yiiActiveForm
  • Loading branch information
SilverFire authored Oct 14, 2016
2 parents fa96756 + 9d98d03 commit b172d17
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Yii Framework 2 Change Log
- Enh #12440: Added `yii\base\Event::offAll()` method allowing clear all registered class-level event handlers (klimov-paul)
- Enh #12580: Make `yii.js` comply with strict and non-strict javascript mode to allow concatenation with external code (mikehaertl)
- Enh #12664: Added support for wildcards for `optional` at `yii\filters\auth\AuthMethod` (mg-code)
- Enh #12744: Added `afterInit` event to `yii.activeForm.js` (werew01f)
- Enh: Method `yii\console\controllers\AssetController::getAssetManager()` automatically enables `yii\web\AssetManager::forceCopy` in case it is not explicitly specified (pana1990, klimov-paul)
- Enh #12198: Added `time` and `datetime` validator short names (nkovacs)

Expand Down
12 changes: 11 additions & 1 deletion framework/assets/yii.activeForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,15 @@
* - jqXHR: a jqXHR object
* - textStatus: the status of the request ("success", "notmodified", "error", "timeout", "abort", or "parsererror").
*/
ajaxComplete: 'ajaxComplete'
ajaxComplete: 'ajaxComplete',
/**
* afterInit event is triggered after yii activeForm init.
* The signature of the event handler should be:
* function (event)
* where
* - event: an Event object.
*/
afterInit: 'afterInit'
};

// NOTE: If you change any of these defaults, make sure you update yii\widgets\ActiveForm::getClientOptions() as well
Expand Down Expand Up @@ -217,6 +225,8 @@
});
$form.on('submit.yiiActiveForm', methods.submitForm);
}
var event = $.Event(events.afterInit);
$form.trigger(event);
});
},

Expand Down

0 comments on commit b172d17

Please sign in to comment.