Commit c9eb0f9e authored by Maxym Borodenko's avatar Maxym Borodenko

"Saved list of accessions" dropdown doesn't close

parent d1412937
......@@ -243,32 +243,40 @@
}
});
$('body').on('input', '#accessionListTitle', function() {
var showError = false;
var title = $(this).val();
<c:forEach items="${userAccessionLists}" var="userList">
$(document).bind('click', function(e) {
var clicked = $(e.target);
if (!clicked.hasClass('dropdown-menu')) {
$('.dropdown').removeClass('open');
$('#get-user-acc-lists').hide();
}
});
$('body').on('input', '#accessionListTitle', function () {
var showError = false;
var title = $(this).val();
<c:forEach items="${userAccessionLists}" var="userList">
var userListTitle = '${userList.title}';
if(userListTitle === $.trim(title)) {
showError = true;
if (userListTitle === $.trim(title)) {
showError = true;
}
</c:forEach>
</c:forEach>
if(showError === true) {
$('#existingTitleError').show();
$('#emptyTitleError').hide();
$('#makeNewListBtn').attr('disabled', true);
} else {
if($.trim(title) === '') {
$('#emptyTitleError').show();
$('#existingTitleError').hide();
$('#makeNewListBtn').attr('disabled', true);
} else {
$('#existingTitleError').hide();
$('#emptyTitleError').hide();
$('#makeNewListBtn').attr('disabled', false);
}
}
});
if (showError === true) {
$('#existingTitleError').show();
$('#emptyTitleError').hide();
$('#makeNewListBtn').attr('disabled', true);
} else {
if ($.trim(title) === '') {
$('#emptyTitleError').show();
$('#existingTitleError').hide();
$('#makeNewListBtn').attr('disabled', true);
} else {
$('#existingTitleError').hide();
$('#emptyTitleError').hide();
$('#makeNewListBtn').attr('disabled', false);
}
}
});
});
</script>
</content>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment