🏠 back to Observable

Autoselect Inputs Cannot be more than one in a modul

I tried to use more than one of autoselect from @jashkenas/inputs but the second autoselect input option data always refering to the first autoselect.

viewof p = autoSelect({  
             value:"",
             title:"first",
             options: firstopt,     
}) 

The second are:

 viewof p = autoSelect({  
             value:"",
             title:"second",
             options: secondopt,     
}) 

The first autoselect works perfectly and the second also but with the same option with first autoselect.,

Please help

Is the problem you’re experiencing is because you’ve used ‘p’ twice as a name?

Maybe try:

viewof p = autoSelect({  
             value:"",
             title:"first",
             options: firstopt,     
}) 

 viewof q = autoSelect({  
             value:"",
             title:"second",
             options: secondopt,     
}) 

EDIT Sorry, I see now the behavior you’re reporting. Is it a somehow a bug of the platform or of JS in general, or maybe a browser memory thing?

Here’s a demo that reproduces your behavior:

Thanks for your feedback,.

Actually i have made both with different name of viewof.,
And the problem have been resloved by adding list name into config to differetiate both object.

Thanks

1 Like

Cool. It’s weird, when I first responded to you, I swear was seeing different inputs. Now there’s nothing I can do to get around the behavior you describe.

Would you be willing to share your fix?

I think there is not error or bug in Autoselect but we don’t know or not enough guide to do it correctly.
Here is my solution that already prepared in autoselect config.

  viewof a = autoSelect({
  list:"a", options: opta)}

And the other AutoSelect are like this

  viewof b = autoSelect({
  list:"b", options: optb)}

But what i don’t like with this input are, that if we want to change the value the list of option are not showing except we should delete the value first.

1 Like

Hi again.

Good call on the list! And yes - I see what you mean about having to clear all the text before you get the list of values back. Not ideal.

Here’s one that might work better for you:

You might also be interested in Choices, an alternative to Select2 and Chosen that doesn’t require jQuery. I found an example implementation here:

1 Like