From 8d24ad2a810f7cf32ef1ef2337a9d1db9d98e8da Mon Sep 17 00:00:00 2001 From: Sean Fridman Date: Tue, 21 Apr 2015 12:12:46 -0400 Subject: Strip newlines before POSTing --- themes/okadmin/public/js/app.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/themes/okadmin/public/js/app.js b/themes/okadmin/public/js/app.js index e981223..4a0f8e3 100644 --- a/themes/okadmin/public/js/app.js +++ b/themes/okadmin/public/js/app.js @@ -94,6 +94,17 @@ var OKAdmin = function(){ $id.val( slug ) } + // Strip newlines + // TODO This is a hack. Remove when server sanitizes + // input correctly + $(this).find('input, textarea').each(function(i, el) { + var $el = $(el); + var val = $el.val(); + if (val) { + $el.val(val.replace(/[\r\t\n]/g, '')); + } + }); + $(".image-element").each(function(index){ $(this).find("input,textarea").each(function(){ var field = $(this).attr("name").replace(/\[[0-9]*\]/, "[" + index + "]") -- cgit v1.2.3-70-g09d2