Apostrophe turns into "'" in Salesforce Name field

I have a simple Opportunity Name field on my page, and when the user enters an apostrophe it looks like the picture above. Is there a way to fix that? I am using a custom field renderer that looks like this:

var field = arguments[0], value = skuid.utils.decodeHTML(arguments[1]),
$ = skuid.$;
if(value != null){
field.mode = ‘read’;

Moshe, could you post / send us the full XML for your page? What is the content of the “Template” property of your Page Title component? 

Could it be that a “New Opportunity” Skuid page you have created is actually causing the issue, since based on your Custom Field Renderer it would be impossible from this page to ever change the Opportunity Name? Is this page used as a Opportunity Detail page?

I’m using {{{Name}}} in the page title, it is a new opportunity page.

Change {{{Name}}} to {{Name}}. Triple-mustached fields are spitting out the raw data for a field, whereas double-mustache syntax is spitting out the HTML-encoded data. 

I just tried that and it didn’t work.

I noticed from your Page XML that there are other Custom Field Renderers that affect the value of the Opportunity Name field, in addition to the one you posted above. If you remove all of these Custom Field Renderers, does the problem persist?

Hey Zach thanks for looking into that, I just realized that there is a point during the save process where I am adding info onto the name, like so:

var currentName = opportunityModel.getFieldValue(row,‘Name’);   
if(currentName != null){
       opportunityModel.updateRow(row,‘Name’,currentName + ’ - ’ + commodity); 
Do you know why that would change the behavior of the Name field.

If I comment out that line the apostrophe appears normally! However is there a way I can get around that because I would still like to update the Opportunity Name…

Yes, change it to this:

var currentName = opportunityModel.getFieldValue(row,'Name',<b>true</b>);&nbsp; &nbsp;<br>if(currentName != null){<br> opportunityModel.updateRow(row,'Name',currentName + ' - ' + commodity);&nbsp;<br>}

The important thing is that 3rd parameter to .getFieldValue(), where we request the UN-ESCAPED value of the field. If you don’t pass in the third parameter true, then you get the ESCAPED value of the field. We do this as a protection against XSS injection, since often people will just use getFieldValue() and dump the value directly to the screen, which could constitute an XSS vulnerability.  

Thanks that works!