From adb77ea699d918da598a4b371605a65d797d07c9 Mon Sep 17 00:00:00 2001 From: John Hess Date: Wed, 30 Jan 2013 21:32:50 -0500 Subject: [PATCH] hack to fix validation issues --- common/static/js/capa/editamolecule.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/common/static/js/capa/editamolecule.js b/common/static/js/capa/editamolecule.js index 21bb5b1e4b..97cbc4d719 100644 --- a/common/static/js/capa/editamolecule.js +++ b/common/static/js/capa/editamolecule.js @@ -131,9 +131,19 @@ function formatInfo(info, input_field, element) { var results = []; + console.log("element parent is"+$(element).parent()) var errordiv = $(element).parent().find('.errormsgs')[0]; console.log(errordiv); - + + if (!errordiv) { + // This is a bit hackish, but works. + // There are situations where formatInfo is called but no div yet exists + // to my knowledge (blame John Hess) this is always followed by a call to + // this function once the div does exist + console.log("There is no errordiv loaded yet. trying again soon"); + return [] + } + if (info.search("It is not possible") == -1) { errordiv.innerHTML = ''; errordiv.style.visibility = 'hidden';