Quick Save Field Renderer

This code is a Frankenstein-esque snippet I mashed together from anything I could find on the community and tutorials works with one flaw. It immediately saves the box or field you edit, but it renders ‘&’ ’ " ’ and " ’ " incorrectly as ‘&’, ‘'’, and ‘"’ in read and readonly mode.

I like that it immediately autosaves selections and text input into fields, but I need to render correctly! (As you can see, my coding skills are still largely in development)


var $ = skuid.$; var field = arguments[0], value = arguments[1], model = field.model, cellElem = field.element, row = field.row; switch( field.mode ){ case 'edit': skuid.ui.fieldRenderers[field.metadata.displaytype].edit( field, value ), skuid.$('body').on('change',function(){ var DELAY = 1; var editor = new skuid.ui.Editor(); var saveChanges = function(){model.save({callback:function(result){}})}; editor.registerModel(model); var Timer = setTimeout(saveChanges,DELAY); editor.handleChange = function(){if (Timer) {clearTimeout(Timer);} };}); break; case 'read': skuid.ui.fieldRenderers[field.metadata.displaytype].read( field, value ); break; case 'readonly': skuid.ui.fieldRenderers[field.metadata.displaytype].readonly( field, value ); break; }<br>