I am trying to make a phone renderer like the built in one for SF and I need some help to make it work fully. I have the below snippet that works but only when the field editor is Read-withInlineEditing and it does not work when the Field Editor is just Edit mode. I need to get that fixed but also, How can I make the transformed text be what is actually saved and not what was actually typed in? Ex. I type in Phone # 123-4567777 and that gets saved I want it to actually save as (123) 456-7777
Here is my Field Renderer code that works on InlineEdit only and only transforms the view of the field not the saving of the data:
var field = arguments[0], value = arguments[1];
// use substring to get at the values…
if(value !== null){
var origstringValue = value.toString();
var stringValue = origstringValue.replace(“-”, “”);
stringValue = stringValue.replace(“(”, “”);
stringValue = stringValue.replace(“)”, “”);
stringValue = stringValue.replace(" ", “”);
stringValue = ‘(’ + stringValue.substring(0,3) + ‘)’ + ’ ’ + stringValue.substring(3,6) + ‘-’ + stringValue.substring(6,10);
if (stringValue == ‘() -’){
stringValue = ‘’;
}
}
skuid.ui.fieldRenderers[field.metadata.displaytype]field.mode;
Question
Phone Field Renderer
This topic has been closed for replies.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
