Skip to content

Commit

Permalink
Inserted Form Validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas0000 committed Nov 17, 2024
1 parent 70544ad commit 042feb5
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions ui/runs/static/runs/runs.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,24 @@ $(document).ready(function () {
$('#chosen-' + id).text(this.files[0].name);
});

// control calculate calculate button in footer
$('#calculate_parameters_submit').click(function() {
$("#calculateForm").submit();
});
// control calculate button in footer
var calculateButton = $('#calculate_parameters_submit');

calculateButton.click(function() {
var form = $("#calculateForm")[0];

if (form.checkValidity()) {
form.submit();

// show loading spinner on calculate button
$('#calculateForm').on('submit', function() {
$('#calculate_parameters_submit').html(`
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
Calculating...
`);
$('#calculate_parameters_submit').prop('disabled', true);
// show loading spinner on calculate button
calculateButton.html(`
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
Calculating...
`);
calculateButton.prop('disabled', true);

} else {
form.reportValidity();
}
});
});

0 comments on commit 042feb5

Please sign in to comment.