I want to disable or hide options in a choice field on a sharepoint list because some of the value should not be selected after a specific date but must be in the list for older items.

Is there a solution with JSLink ? With the following i got the field:


and with this js snippet i got the field with the choices:

var c = ctx.ListSchema.Field.filter(function(f) {
        return f.Name === 'Period';
//This will set the array to a new array
c[0].Choices = ["test","test"]

Now the array is set to the "test" array if I reload the page. But, the values are not renderd to the Dropdown... there are still the normal values from the choice field.

if I do the same with the grid value it will be renderd correctly:

c[0].AllowGridEditing = "FALSE"

Is there a way to manipulate the choice field? Or maybe if I implement it as Lookup field?


1 Answer 1


If you change the choices in the "Period" column it will not affect the current choice selected in previous list items unless the list items are edited. If you change the choices and then edit an older item, the selection is removed if it's no longer an available choice, again, that's only if the item is edited. However, if you modify the choices using JSLink you will run into the same issue if the old items are edited. If the old items will never be edited, you can safely change the choice options without worrying about losing the old values in older items.

If the old items may be edited, you could consider renaming your old choice column and creating a new choice column with new values, then making the old column read only so it cannot be changed even if old items are edited. Once read-only the values will not change, even if the choices in the columns have changed.

Here's a way to make a column read-only with JSLink.

(function () { 

// Create object we want to change it's output render  
var readonlyFiledContext = {}; 
readonlyFiledContext.Templates = {}; 
readonlyFiledContext.Templates.Fields = { 
    // Apply the new rendering for Period field on Edit forms  
    "Period": { 
        "EditForm": readonlyFieldTemplate 



// This function provides the rendering logic 
function readonlyFieldTemplate(ctx) { 

//Reuse ready sharepoint javascript libraries 
switch (ctx.CurrentFieldSchema.FieldType) {  
    case "Choice": 
        return SPField_FormDisplay_Default(ctx); 

Be sure to place the JSLink on the edit form. Keep in mind that if you change the column name, you must use the original column name in the function. You could change the column name to "Period (Historical)" but you still have to use "Period" in the function. Then create a new column "Period" with new values.

Reference: https://code.msdn.microsoft.com/office/Sample-8-List-add-and-edit-d228b751

  • Hi thank you for your answer. The reason for removing options from the choice field is because some periods will be closed and it should not be possible to select the old values. But, in the old items the old period values must be populated. So I try to only remove some values from the dropdown in the quick edit if a user click on the choice field.... I don't know how the read only helps me here or i didn't understood your explanation...
    – theface
    Mar 1, 2018 at 12:19
  • My answer was based on what I could surmise from your original description and was partially to elicit further details. I wanted to leave a comment but, my lowly reputation disallows it... Read only won't really apply here I suppose. Do you have a "Status" column indicating when an item is closed? You could use that value to trigger read only on the Period column. Of course you would then want to also make the "Status" column read only once set to closed.
    – AtariPixel
    Mar 1, 2018 at 12:29
  • The problem is not the read only on the columns. It is more the selectable options on the dropdown which are populated by the system ... I can not remove values with javascript/jquery or change the choices on the array of the field...
    – theface
    Mar 1, 2018 at 13:11
  • Why would you need to remove values with JavaScript when you could just change the select column fields? If an item is closed, the Period column becomes read-only and will never change. Then, you can just change the choices in the Period column. Anyway, just an idea.
    – AtariPixel
    Mar 1, 2018 at 13:53
  • I have to remove this values from the dropdown because a administrator should be able to change this values. This will be done by a powershell in the background... A normal user don't have the permissions to change old values but it must be saved in the list for reporting etc. If a new item is added by a user, the old periods must be removed from the choice dropdown.
    – theface
    Mar 1, 2018 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.