special characters replaced with unescaped characters on skuid ui page.

  • 1
  • Problem
  • Updated 8 months ago
  • Solved
Hi Team,

I am rendering a field as picklist using custom rerender, the value of the field can have special characters. So we are seeing issue while rendering the value on the skuid UI.

Value in stage is showing as below instead of RFP & Financial analysis

Stage : RFP & Financial analysis
Photo of Praveen Pannala

Praveen Pannala

  • 580 Points 500 badge 2x thumb

Posted 8 months ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Are you using our Field Renderer API?  (See here:  https://docs.skuid.com/v11.1.1/en/skuid/api/skuid_ui.html?highlight=renderer#skuid-ui-field-renderer... ) .  These renderers should escape special characters correctly. 

If you are able to use a declarative solution by merging the field values in a tempalate  like this:  {{fieldName}} -- special characters should be escaped for you. 
Photo of Praveen Pannala

Praveen Pannala

  • 580 Points 500 badge 2x thumb
Am rendering the field using a custom snippet. Below is the javascript snippet running during render.

(function(skuid,$){
  var snippet = skuid.snippet,
    ui = skuid.ui;

snippet.registerSnippet("StageFieldRenderer", function(field,value, skipCondition){
if (field.mode === 'edit') {

//  Build the Options for the PICKLIST
var customOpts = [];
var playbookMasterObject = skuid.$M('Playbook');
var newProject = skuid.$M('Project');
skuid.$.each(playbookMasterObject.getRows(), function(i,row) {
if(skipCondition || (row.Client_Name__c === field.row.Account__r.Client_Name__c && row.Project_Type__c === field.row.Project_Type__c)){
console.log(skipCondition);
customOpts.push({
value : row.Stage__c,         // Will be stored in target object 
label : row.Stage__c        // Will display in the PICKLIST
});
}
});

//  Render the options as a PICKLIST
var customSelect = skuid.ui.renderers.PICKLIST.edit({
entries : customOpts,
required : false,
value : value
}).change(function() {
   //  Update the row in the target object
field.model.updateRow(field.row,'Stage__c',skuid.$(this).val());
});

//  Append the PICKLIST to the DOM element
field.element.append(customSelect);
} else {
//  If the mode is anything other than edit, display the field as Text
skuid.ui.fieldRenderers.TEXT[field.mode](field,field.model.getFieldValue(field.row,'Stage__c'));
}
});
}(skuid,skuid.$));
 
Photo of Praveen Pannala

Praveen Pannala

  • 580 Points 500 badge 2x thumb
@rob Can you please help me with this.