Jump to content
  • 0

Remove "No options available" on a cascading dropdown field


Question

Hi,

Just a quick question about removing a certain value in a Cascading dropdown. I want to Remove "No options available" on a cascading dropdown field. Once I don't have yet any value in my cascading dropdown the default value is "No options available". How can I remove that default value? 

 

Thank you for your assistance.

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hi,

Regarding your inquiry, removing the "No options available" will require JavaScript. Please follow the steps below:

a. On your Configure Results Page Fields, Add a Header and Footer Element.
b. Go to the Footer and disable the HTML editor by going to the Advanced tab and unchecking the box next to "Enable HTML editor". 
c. Click the Standard tab.
d. Add the following code to remove the "No options available".
<script type="text/javascript">
document.addEventListener('DataPageReady', setDropdownDefaults);
setTimeout(setDropdownDefaults,500);
function setDropdownDefaults() {
var dd = document.querySelectorAll('.cbFormSelect');
console.log(dd);
for (var i = dd.length - 1; i >= 0; i--) {
dd.disabled = false;
var opt = dd.querySelector('option:nth-child(1)');
opt.innerHTML = "";
}
}
</script>
 

I hope that helps.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...