Is it possible to use Sharepoint Form Customizers to have a column in a list have a dynamic choice dropdown, where the choices are dependent on the previous column?
For example, Internal Group is Group 1, so Category will have a choice of category 1, category 2, category 3, etc.
I’ve been using Visual Studio Code to try and figure it out, and I’m unsure if this is even possible at this point in time.
Here is a sample of my code that I’ve been working with. I’m not sure what else to try when trying to make this column work. (Actual categories and groups removed for privacy)
private _updateCategoryDropdown(internalGroupValue: string): void {
const categoryField: HTMLSelectElement | null = this._getFieldElementByName(‘Category’);
if (categoryField) {
categoryField.innerHTML = ”;
let options: string[] = [];
switch (internalGroupValue) {
case 'Group 1':
options = ['Category 1', 'Category 2', 'Category 3'];
break;
case 'Group 2':
options = ['Category 4', 'Category 5', 'Category 6'];
break;
}
options.forEach(option => {
const optionElement: HTMLOptionElement = document.createElement('option');
optionElement.value = option;
optionElement.text = option;
categoryField.appendChild(optionElement);
});
}
}
Luka Gasai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.