Skip to main content
Nintex Community Menu Bar

Is there a way to get at the none label in a picklist created by a custom field renderer? I have an integer field that is conditionally rendered as a Yes/No picklist. We’ve been using a separate field Not_Applicable__c but I’d rather just use the blank value of my Value__c field and relabel to say “n/a”


I’ve tried field.options.nonelabel=“n/a” and field.options.addnoneoption=“true” which mimics what shows up for a normal field in the XML when you make it required and add a none option, but they don’t have an effect. They either don’t add a none option to my radio buttons, or if I make the field not required, the default null option shows “-none-”


Here’s the snippet I am using


var field = arguments 0],


row = field.row,

value = skuid.utils.decodeHTML(argumentsd1]),

metadata = field.metadata,

element = field.item.element,

$ = skuid.$;

isNA = (row.Not_Applicable__c);

isYes = (row.Type__c == 'Yes') ? true : false;

isNo = (row.Type__c == 'No') ? true : false;

response = row.Value__c;

console.log(response);

if (!isNA){


field.item.element.removeClass("gray-row");

field.item.element.removeClass("nodisplay");

if (isYes){


            //create a blank variable for picklist entries

var picklistEntries = ;


// set the picklist entries. note defaultValue doesn’t matter, the first one will be default


picklistEntries.push(

{ value: ‘0’, label: ‘Yes’, defaultValue: false, active: true },


{ value: ‘1’, label: ‘No’, defaultValue: false, active: true }


);


field.metadata.picklistEntries = picklistEntries;

field.options.type = 'RADIO_BUTTONS';

// render the field as a picklist


skuid.ui.fieldRenderers.PICKLIST.edit(field,value);

}


if (isNo){


//create a blank variable for picklist entries

var picklistEntries = ;


// set the picklist entries. note defaultValue doesn’t matter, the first one will be default


picklistEntries.push(

{ value: ‘0’, label: ‘No’, defaultValue: false, active: true },


{ value: ‘1’, label: ‘Yes’, defaultValue: false, active: true }


);


field.metadata.picklistEntries = picklistEntries;

field.options.type = 'RADIO_BUTTONS';

// render the field as a picklist


skuid.ui.fieldRenderers.PICKLIST.edit(field,value);

field.item.element.removeClass(“gray-row”);


}


if (!isNo && !isYes){


//use the default renderer

skuid.ui.fieldRenderersefield.metadata.displaytype]field.mode;


}


}


if (isNA){


field.item.element.addClass(“gray-row”);


field.item.element.addClass(“nodisplay”);


}


Hey @Jack_Sanford


  1. , I have a few questions:

    are you trying to create or change/modify that label


are you trying to render the picklist as "none" when it requires a default value?

Also, have you seen this post?




Is it possible to change the default “–None–” value (when you have a required field and enable the ‘Add “None” option’) to different text? In our case, we would like to tell the user to select something (“Select…” for example) whereas “–None–” implies they selected “None” as their value. This is especially confusing when the dropdown includes the value “None” as one of the options.

Maybe this can be done with labels / translations?

Thanks as always!

- Chris




Hi @Germany, I’m trying to achieve what you can do in the builder ui for a required picklist field - where you can add a none selected option, and change the text that shows up when none selected. I’m just trying to do that in this snippet since the actual field is an integer and I’m only sometimes making it a picklist


Hey @Jack_Sanford , i found another thread that could help with your use case:




I have a page where users need to be able to change a picklist to change the status of a record, such as “working”, “submitted”, etc. However, normal users shouldn’t be able to put it into the approved status. I know I can add a validation rule that says "if the user’s profile = x and the picklist value = “approved”, then throw error message ‘you can’t select that’ ", but the ideal way, of course, is to prevent a normal user from being able to select the “accepted” value in the first place. This seems like a perfect opportunity for a custom Skuid renderer! I’m thinking that in read mode the picklist shows the current value, but in edit mode it shows only values that the current user has access to based on their profile. Something like: if (field.mode == ‘read’) { skuid.ui.fieldRenderers)field.metadata.displaytype]field.mode; } else if (field.mode == ‘edit’) { /* if (profile != admin) { add picklist value ‘working’; add picklist value ‘submitted’; } else if (profile = ‘admin’) { add picklist value ‘approved’; } render picklist in edit mode */ } How would I do this (or create an equivalent or similar solution)? Bonus points: Maybe it can also prevent normal users from changing the status from “approved” to something else?



If you see Zach’s solution, it provides a good example that is (or close to) what you’re trying to achieve.


skuid.ui.fieldRenderershfield.metadata.displaytype]cfield.mode](field,value);
var select = field.element.find('select');
if (select.length) {
// Remove unwanted entries
$.each(select.children('option'),function(){
if ($(this).val()==='blah')) $(this).remove();
});
// Add new entries
select.append($('<option value="cheese">Cheese</option>'));
}

you can add or remove or add the value of what you are trying to change.


I hope this helps!


Reply