2amigos / yii2-ckeditor-widget

CKEditor WYSIWYG widget for Yii2.
https://2amigos.us/open-source/ckeditor-widget
Other
172 stars 112 forks source link

How to disable beforeunload action when user is submitting a form? #47

Closed pugovok closed 8 years ago

pugovok commented 9 years ago

How to disable beforeunload action when user is submitting a form?

Example:

<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'text')->widget(\dosamigos\ckeditor\CKEditor::className(),[
   'options' => ['rows' => 10],
   'preset' => 'full'
]); ?>
pugovok commented 9 years ago

It may be so,

$js = <<<JS
$('form').submit(function() {
    $(window).unbind('beforeunload');
});
JS;
$this->registerJs($js);

but it's bad

tonydspaniard commented 8 years ago

http://www.ramirezcobos.com/2014/09/12/how-to-implement-form-events-on-yii2/