Filter a Sharepoint Choice Field?

Can you use a filter on a choice field like you can with a lookup? I’d like to remove some choices from a dropdown but not having any luck. Thanks.

I need similar to this, is there a way to remove choices on dropdown? i.e. I have six choices and I want to remove choice number 4?


Dear @Bjorn, @Tony_Duke,

A choice field and a lookup have different mechanics, therefore the lookup filter’s approach is not suitable for the choice field.

You can get the options array by this code:

var options = $(fd.field("Choice").$el).find("option");

Notice that “Choice” is the internal name of your choice field.

Also, you can filter by options[i].value and hide option by options[i].hidden = true;

If you want to completely remove the option, then use this code: options[i].remove();

Exactly what I was looking for, thanks!

Hi Alex,

Having a few issues with this one my code and errors are below: -

fd.spRendered(function() {


    // Function to hide Deposit from Invoice Type
	function hideDepositChoiceFromInvoiceType () {
		var options = $(fd.field("Invoice_x0020_Type").$el).find("Deposit");

Error: -

VM5755 spform.js:1 ReferenceError: i is not defined
at hideDepositChoiceFromInvoiceType (eval at e._executeCustomJavaScript (VM5327 spform.js:38), :34:11)
at eval (eval at e._executeCustomJavaScript (VM5327 spform.js:38), :21:2)
at VM5327 spform.js:1
at ()
at Function.e.safeRun (VM5327 spform.js:1)
at VM5327 spform.js:68

I tried using the options[i].hidden = true; function and received the same error and as this is a single choice field, tried removing the [i]. This stopped the error occurring but didnt give the desired result…


1 Like

Dear Tony,

I’m not sure about “find(“Deposit”)” code. If “Invoice_x0020_Type” is a choice field then you should use “find(“option”)” to find all elements with “option” tag.

“options” is an array of options, so to get access to an option, you should iterate it first by “for (var i = 0; i < options.length; i++)” construction.