Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Autocomplete] Only add the clear_button plugin to TomSelect if the form element is not required #422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from

Conversation

bendavies
Copy link
Contributor

@bendavies bendavies commented Aug 11, 2022

Q A
Bug fix? no
New feature? yes
Tickets Fixes #402
License MIT

Only add the clear_button plugin to TomSelect if the form element is not required

@bendavies bendavies force-pushed the autocomplete-respect-required branch 2 times, most recently from 9d852c7 to 2a76894 Compare August 11, 2022 21:29
@bendavies bendavies marked this pull request as ready for review August 11, 2022 21:29
@bendavies bendavies changed the title Only add the clear_button plugin to TomSelect if the form element is not required [Autocomplete] Only add the clear_button plugin to TomSelect if the form element is not required Aug 12, 2022
@bendavies bendavies force-pushed the autocomplete-respect-required branch 5 times, most recently from 9d059b4 to 8e0d222 Compare August 12, 2022 20:43
@bendavies bendavies force-pushed the autocomplete-respect-required branch 2 times, most recently from ac5bf11 to 270a101 Compare June 19, 2023 22:13
@bendavies bendavies force-pushed the autocomplete-respect-required branch 6 times, most recently from e82122d to 57e7c38 Compare February 29, 2024 17:04
@bendavies bendavies force-pushed the autocomplete-respect-required branch from 57e7c38 to d5ac497 Compare February 29, 2024 17:15
@bendavies bendavies force-pushed the autocomplete-respect-required branch from d5ac497 to 5bfb733 Compare February 29, 2024 17:43
@Bartheyrman22
Copy link
Contributor

Bartheyrman22 commented Jun 3, 2025

The validation is working correctly if you provide the following options:

$builder
    ->add('testElement', ChoiceType::class, [
        'autocomplete' => true,
        'choices' => $choices,
        'required' => false,
        'attr' => [
            'required' => true,
        ],
    ])

Set required to false and add a required-attribute instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Autocomplete] required choice types end up not being required.
4 participants