Skip to content

Commit

Permalink
Make sure buttons stay enabled when html5 validation fails
Browse files Browse the repository at this point in the history
  • Loading branch information
flack committed Mar 17, 2019
1 parent ea28707 commit 892b1bf
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions static/midcom.workflow/workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,18 @@ $(document).ready(function() {
.dialog(options);
});
$('body').on('click', '.midcom-workflow-dialog .ui-dialog-buttonpane .ui-button', function() {
$(this).closest('.ui-dialog-buttonpane').find('.ui-button')
.addClass('ui-state-disabled');
var pane = $(this).closest('.ui-dialog-buttonpane'),
iframe = pane.prevAll('#midcom-dialog').find('iframe'),
disabler = function() {
pane.find('.ui-button')
.addClass('ui-state-disabled');
};

if (!$(this).hasClass('dialog-extra-button') && $('form.datamanager2', iframe.contents()).length > 0) {
$('form.datamanager2', iframe.contents()).on('submit', disabler);
} else {
disabler();
}
});
});

Expand Down

0 comments on commit 892b1bf

Please sign in to comment.