question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot use setChoices, Please Help!

See original GitHub issue

Describe the bug When using select-multiple (or all, I haven’t tested others), calling setChoices will result in a TypeError (Cannot read property ‘removeLoadingState’ of undefined). It looks like the setChoices is trying to access containerOuter, but it cannot for whatever reason. The Choices that are passed to the method make no difference, neither do the value and label values, nor the replaceData option.

I would give you code examples, but there is no code that doesn’t result in this error, so it would be mostly useless.

This is concise because I fully believe I am doing something wrong. I have tried various versions of Choices.js but only 7.1.5 works, and that is simply too old. I have tried so many things to get it to work with zero luck that I felt like I should open an issue. I really hope I just overlooked something! Maybe someone else might also run into this issue at some point…

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:5

github_iconTop GitHub Comments

3reactions
davidchenfncommented, Feb 23, 2021

Make sure you’re not calling new Choices on the same element multiple times. This was causing this error for me, e.g.

const element = document.querySelector('.js-choice');
this.choices = new Choices(element);
//Some time later...
this.choices = new Choices(element);
2reactions
realnotcommented, Jun 10, 2022

Make sure you’re not calling new Choices on the same element multiple times. This was causing this error for me, e.g.

const element = document.querySelector('.js-choice');
this.choices = new Choices(element);
//Some time later...
this.choices = new Choices(element);

How do you get initialized instances?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot use setChoices, Please Help! · Issue #888 - GitHub
It looks like the setChoices is trying to access containerOuter , but it cannot for whatever reason. The Choices that are passed to...
Read more >
Google Script (Forms) - Cannot Convert Array to Choice[]
However, when attempting to put my array of new choices into setChoices([]), I get the error message "Cannot convert Array to Choice[]". My...
Read more >
Class ListItem | Apps Script - Google Developers
Creates a new choice with a page-navigation option. Choices that use page navigation cannot be combined in the same item with choices that...
Read more >
Solved: Re: Can't use setOptions method for a visualizatio...
Can't use setOptions method for a visualization. There is an example of how to set options for a visualization - setOptions method ‒...
Read more >
How do i fetch stage set choices from the Requeste...
Hi, I'am using the widget "Requested Item" and my objective is to get the stage set data (current and all stage set ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found