web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :

How to clear options without leaving an empty entry

ScottDurow Profile Picture ScottDurow 21

Using the clearOptions method on PickLists, can leave an empty entry because Drop Down lists in HTML must have at least one entry.

To work around use the following code that removes all options other than the current value to avoid the empty entry.

var attribute = Xrm.Page.getAttribute(“attributename”);
// NOTE: We can't use clearOptions since this adds an empty option 
// attribute.controls.forEach(function (control) { control.clearOptions(); })

for (var j = 0; j 

If this doesn't work for you, the empty entry can be manually removed using:


attribute.controls.forEach(function (control) { 
control.removeOption('') 
});


This was originally posted here.

Comments

*This post is locked for comments