diff --git a/js/functions.js b/js/functions.js index a55818c7c..0d693e681 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1794,6 +1794,13 @@ $(document).ready(function() { var values = $(this).parent().prev("input").attr("value").split(","); $.each(values, function(index, val) { if(jQuery.trim(val) != "") { + // enclose the string in single quotes if it's not already + if(val.substr(0, 1) != "'") { + val = "'" + val; + } + if(val.substr(val.length-1, val.length) != "'") { + val = val + "'"; + } // escape the single quotes, except the mandatory ones enclosing the entire string val = val.substr(1, val.length-2).replace(/'/g, "'"); // escape the greater-than symbol