Created
March 4, 2021 13:15
-
-
Save bscheshirwork/0a2dbca02d69d081ef31fe867ce9c9ec to your computer and use it in GitHub Desktop.
yii2 avoid second time send form if page not been reloaded (for example if this form call file for download)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('form').on('beforeSubmit', function(event) { | |
let $form = $(this), | |
data = $form.data('yiiActiveForm'); | |
if ($form.data('yiiSubmitFinalizePromise') && data.validated) { | |
data.validated = false; | |
return true; | |
} | |
return false; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment