-
-
Notifications
You must be signed in to change notification settings - Fork 315
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
[Autocomplete] required choice types end up not being required. #402
Comments
I do not agree that those issues are the same as this one - those are about completely overriding the default plugins setup by this issue: I think symfony/ux-autocomplete should be more intelligent/correct out of the box with reguards to required |
@bendavies Agree, not the same but related. |
Hi there! Really excellent issue and explanation of the problems Ben - thanks for that. As Ben mentioned, the
|
yep, that looks doable. we just need to pass a new required |
@bendavies do you have any news? 👀 |
forgot about this. i'll take a look again |
This is still an issue as far as I can tell. How do we proceed to get the PR merged? Although thinking about this some more, I feel like the "clearability" of a select is related more to whether there is a placeholder or not. (At least that's how I have always implemented my own js enhanced select elements.) I would have to dive into the code to see how the placeholder is deduced, although I wouldn't be opposed to the solution proposed in the PR, as it would still be a major improvement over what there is now. Edit: I made an attempt at a pull request that implements the placeholder check |
Hi there,
There seems to be an issue with how tom-select is configured, for required, non-multiple choice types.
Given a form type configuration like
You will be left with a select box like:
All well and good, an option is mandatory.
However, convert to
autocomplete
and you're left with:see the issue? It's clearable because the
clear plugin
is added, so you can be left with no value.this shouldn't be possible, as it isn't with the simple select box above.
We can try fix fix:
this has no effect for 2 reasons:
requried
into considertion, from which symfony/ux-autocomplete was inspired by)Number 2 can be "fixed"/overridden like this:
but that would mean we still have to fix the stimulus controller here to not add the clear button if there is a
required
attribute.my "fix" above (adding
'attr' => ['required' => true]
) is probably too onerous to put on the end user. Maybe the autocomplete form type should do this automatically?Thanks
The text was updated successfully, but these errors were encountered: