Skip to content

Commit

Permalink
Обновление авторизации
Browse files Browse the repository at this point in the history
  • Loading branch information
skeeks-semenov committed May 26, 2023
1 parent cc50973 commit 98f58c5
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/widgets/ActiveFormAjaxBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class ActiveFormAjaxBackend extends ActiveForm implements IActiveFormHasFieldSet
* @var bool
*/
public $enableClientValidation = true;

public $clientSuccess = null;

public function init()
{
Expand All @@ -71,11 +73,22 @@ public function init()
$this->_initDynamicReload();

if (!$this->clientCallback) {
$successCallback = 'null';
if ($this->clientSuccess) {
$successCallback = $this->clientSuccess;
}
$this->clientCallback = new \yii\web\JsExpression(<<<JS
function (ActiveFormAjaxSubmit) {
ActiveFormAjaxSubmit.on('success', function(e, response) {
var clientSuccess = {$successCallback};
if (clientSuccess) {
if (clientSuccess(ActiveFormAjaxSubmit) === false) {
return false;
}
}
$('.sx-buttons-standart .sx-success-meessage', ActiveFormAjaxSubmit.jForm).empty().append(response.message);
ActiveFormAjaxSubmit.jForm.removeClass("sx-form-data-changed");
Expand Down

0 comments on commit 98f58c5

Please sign in to comment.