Skip to content

[UX Autocomplete] setting "tom_select_options" overrides some default values set by ux which breaks plugin #2002

@sabat24

Description

@sabat24

Tested on 2.10.

When creating FormType:

  1. Set autocomplete_url to some custom url.
  2. Set some custom plugin you want to add via tom_select_options
$builder->add('field', ChoiceType::class, [
                'choices' => [
                    'Select something' => '',
                ],
                'autocomplete' => true,
                'autocomplete_url' => 'custom_url,
                'tom_select_options' => [
                    'plugins' => ['dropdown_input'],
                ]
            ]);
  1. On site open select to choose something and you will get an error in console from ux-autocomplete controller

Uncaught TypeError: this.getUrl is not a function

The error is caused because of that ux-autocomplete controller adds virtual_scroll as a plugin by default when url option is set. However providing plugins option directly overrides it. Knowing that fact I can set of course it manually

'tom_select_options' => [
    'plugins' => ['dropdown_input', 'virtual_scroll'],
]

It would be nice if some required default options were merged instead of replacing them. Or at least there may be some information in doc what kind of options should be set to not override those created by ux-autocomplete controller.

Activity

smnandre

smnandre commented on Jul 24, 2024

@smnandre
Member

This seems to be the same as: #1128

Do you think you could open a PR to fix this bug and merge correctly ?

sabat24

sabat24 commented on Jul 24, 2024

@sabat24
Author

This seems to be the same as: #1128

Yes. It's a duplicate.

Do you think you could open a PR to fix this bug and merge correctly ?

Probably yes. However, I am struggling with a higher priority issue related to Autocomplete and LiveComponent, so I will start to work on this not earlier then 3 weeks.

carsonbot

carsonbot commented on Jan 25, 2025

@carsonbot

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

carsonbot

carsonbot commented on Feb 8, 2025

@carsonbot

Friendly reminder that this issue exists. If I don't hear anything I'll close this.

carsonbot

carsonbot commented on Feb 22, 2025

@carsonbot

Hey,

I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!

Kocal

Kocal commented on Jun 13, 2025

@Kocal
Member

Duplicate of #1128

added a commit that references this issue on Jun 16, 2025
ae07fdc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @smnandre@Kocal@sabat24@carsonbot

      Issue actions

        [UX Autocomplete] setting "tom_select_options" overrides some default values set by ux which breaks plugin · Issue #2002 · symfony/ux