Merge pull request #7545 from lasniscinote/gl_SCI_10686

(fix) No error message at create new task modal from canvas [SCI-10686]
This commit is contained in:
aignatov-bio 2024-05-10 13:44:27 +02:00 committed by GitHub
commit 69006c033b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 1 deletions

View file

@ -23,6 +23,23 @@
}
});
});
$('#experiment-canvas').on('shown.bs.modal', () => {
// disable the submit button by default
$('#new-modal-submit-btn').prop('disabled', true);
// listen for input event on the my_module_name input field
$(`${newMyModuleModal} #my_module_name`).on('input', function () {
if ($(this).val().trim() !== '') {
// enable the submit button if the input field is populated
$('#new-modal-submit-btn').prop('disabled', false);
} else {
// otherwise, disable it
$('#new-modal-submit-btn').prop('disabled', true);
}
});
});
// Modal's submit handler function
$(experimentWrapper)
.on('ajax:success', newMyModuleModal, function() {

View file

@ -71,7 +71,7 @@
<button type="button" class="btn btn-secondary" data-dismiss="modal">
<%= t('general.cancel') %>
</button>
<%= f.submit t('experiments.canvas.new_my_module_modal.create'), class: "btn btn-primary" %>
<%= f.submit t('experiments.canvas.new_my_module_modal.create'), class: "btn btn-primary", id: "new-modal-submit-btn" %>
</div>
</div>
</div>