I have a model District. For creating a new district record, I enter district name in text box and click on Create button. The district record gets created. Now while creating if I click many times the create button, then multiple times the data gets saved. I want to disable the Create button after successful validation in yii2, so that it can prevent multiple submission.
In the beforeSubmit event of ActiveForm js:
$('#form').on('beforeSubmit', function (e) {
$('#submitButton').css('disable', 'disable');
return true;
});
Considering #form as form id and submitButton as submit button id.