mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-11 01:14:30 +08:00
35 lines
No EOL
1,005 B
JavaScript
35 lines
No EOL
1,005 B
JavaScript
$.fn.clear_form_errors = function() {
|
|
$(this).find('.nav.nav-tabs li').removeClass('has-error');
|
|
$(this).find('.form-group').removeClass('has-error');
|
|
$(this).find('span.help-block').remove();
|
|
};
|
|
|
|
$.fn.clear_form_fields = function() {
|
|
$(this).find("input")
|
|
.not("button")
|
|
.not('input[type="submit"], input[type="reset"], input[type="hidden"]')
|
|
.not('input[type="radio"]') // Leave out radios as this messes up Bootstrap btn-groups
|
|
.val('')
|
|
.removeAttr('checked')
|
|
.removeAttr('selected');
|
|
};
|
|
|
|
function removeBlankFileForms(form) {
|
|
$(form).find("input[type='file']").each(function () {
|
|
if (!this.files[0]) {
|
|
$(this).closest("fieldset").remove();
|
|
}
|
|
});
|
|
}
|
|
|
|
// Not the actual Excel tables, but are similar
|
|
function removeBlankExcelTables(tables, editMode) {
|
|
if(!editMode) {
|
|
// In edit mode, tables can't be blank
|
|
tables.each(function () {
|
|
if (!$(this).find("td:not(:empty)").length) {
|
|
$(this).closest("fieldset").remove();
|
|
}
|
|
});
|
|
}
|
|
} |