Add callback to clear form errors at create wopi files [SCI-8927] (#5877)

* Add callback to clear form errors at create wopi files [SCI-8927]
This commit is contained in:
ivanscinote 2023-08-02 15:34:36 +02:00 committed by GitHub
parent 7a8663779e
commit 5a531c98ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -41,6 +41,11 @@ function initCreateWopiFileModal() {
msg = I18n.t('assets.create_wopi_file.errors.not_found');
}
renderFormError(undefined, element, msg);
})
.on('input', '#new-wopi-file-name', function() {
if (this.value.length <= GLOBAL_CONSTANTS.FILENAME_MAX_LENGTH) {
$(this).closest('form').clearFormErrors();
}
});
}

View file

@ -10,5 +10,6 @@ const GLOBAL_CONSTANTS = {
REPOSITORY_CHECKLIST_ITEMS_PER_COLUMN: <%= Constants::REPOSITORY_CHECKLIST_ITEMS_PER_COLUMN %>,
REPOSITORY_STOCK_UNIT_ITEMS_PER_COLUMN: <%= Constants::REPOSITORY_STOCK_UNIT_ITEMS_PER_COLUMN %>,
HAS_UNSAVED_DATA_CLASS_NAME: 'has-unsaved-data',
DEFAULT_ELEMENTS_PER_PAGE: <%= Constants::DEFAULT_ELEMENTS_PER_PAGE %>
DEFAULT_ELEMENTS_PER_PAGE: <%= Constants::DEFAULT_ELEMENTS_PER_PAGE %>,
FILENAME_MAX_LENGTH: <%= Constants::FILENAME_MAX_LENGTH %>,
};