From c6fe94442e5cdb4cdc21b716595ce753a10e0194 Mon Sep 17 00:00:00 2001 From: rjy7 Date: Tue, 13 Jul 2010 14:11:37 +0000 Subject: [PATCH] NIHVIVO-725 Define acFilter before the sparql query, so in case the latter fails we don't get an error later when referencing the filter. --- .../forms/js/customFormWithAdvanceTypeSelection.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js b/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js index 39f2a86d..ec9673ac 100644 --- a/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js +++ b/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js @@ -173,7 +173,9 @@ var customForm = { }, getAcFilter: function() { - + // Define this.acFilter here, so in case the sparql query fails + // we don't get an error when referencing it later. + this.acFilter = []; $.ajax({ url: customForm.sparqlQueryUrl, data: { @@ -189,12 +191,11 @@ var customForm = { }, setAcFilter: function(data) { - var filter = [], - key = data.head.vars[0]; + var key = data.head.vars[0]; + $.each(data.results.bindings, function() { - filter.push(this[key].value); - }); - this.acFilter = filter; + this.acFilter.push(this[key].value); + }); }, filterAcResults: function(results) {