From ddb6633c737a2a27fa559a3b831f01b815acea78 Mon Sep 17 00:00:00 2001 From: lorilee Date: Tue, 27 Jul 2010 17:40:30 -0700 Subject: [PATCH] Updated enum/set editor (encloses strings in single quotes automatically) --- js/functions.js | 7 +++++++ 1 file changed, 7 insertions(+) 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