From 8f4a7d775d65833ba376e2913b19ea0b832b1217 Mon Sep 17 00:00:00 2001 From: Chad Estioco Date: Sat, 12 Mar 2016 16:27:29 +0800 Subject: [PATCH] Hopefully, this clears the lis properly (untested). --- librarian/static/scripts/add-books/main.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/librarian/static/scripts/add-books/main.js b/librarian/static/scripts/add-books/main.js index dc71d754..5493b989 100644 --- a/librarian/static/scripts/add-books/main.js +++ b/librarian/static/scripts/add-books/main.js @@ -184,12 +184,10 @@ function renderContentCreatorListing(creatorType){ var hiddenLastnameProxy = document.createElement("input"); hiddenLastnameProxy.type = "hidden"; hiddenLastnameProxy.name = creatorType + "-proxy-lastname"; - console.info("created hidden field with name", hiddenLastnameProxy.name); var hiddenFirstnameProxy = document.createElement("input"); hiddenFirstnameProxy.type = "hidden"; hiddenFirstnameProxy.name = creatorType + "-proxy-firstname"; - console.info("created hidden field with name", hiddenFirstnameProxy.name); var divRow = document.createElement("div"); $(divRow).addClass("row"); @@ -347,6 +345,15 @@ function loadToForm(reqData){ insertAllCreators(reqData.translators, "translator"); } +/** +Clear all the user listings of their children li elements. +*/ +function clearLists(){ + for(var i = 0; i < CREATORS.length; i++){ + $("#" + CREATORS[i] + "-list").empty(); + } +} + $.validator.addMethod("isbnVal", function(value, element, param){ var stripped = stripExtraneous(value); return verifyISBN10(stripped) || verifyISBN13(stripped); @@ -451,6 +458,7 @@ $(document).ready(function(){ window.visualQueue.prepend(spine); updateStatCounts(); clearProxyForm(); + clearLists(); } });