Skip to content
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

Problem with autocomplete field #16

Open
lgeorgiev opened this issue Jan 3, 2024 · 2 comments
Open

Problem with autocomplete field #16

lgeorgiev opened this issue Jan 3, 2024 · 2 comments

Comments

@lgeorgiev
Copy link

lgeorgiev commented Jan 3, 2024

Hello,

Happy New Year!

When I use autocomplete=true, it selects the last element from the select element. I think it sometimes works correctly when I use the autocomplete=true option.
When I removed autocomplete it worked as expected.

->addDependent('exercise', ['goalType'], function (DependentField $field, ?GoalType $goalType) {
    if (!$goalType || $goalType->value == GoalType::BodyWeight->value) {
        return;
    }
    $field->add(EntityType::class, [
          'required' => true,
          'class' => Exercise::class,
          'choice_label' => 'name',
          'empty_data' => null,
          'placeholder' => '',
          'autocomplete' => true,
    ]);
})

What could be the reason?

@rvmourik
Copy link

rvmourik commented Jan 12, 2024

Hello,

Happy New Year!

When I use autocomplete=true, it selects the last element from the select element. I think it sometimes works correctly when I use the autocomplete=true option. When I removed autocomplete it worked as expected.

->addDependent('exercise', ['goalType'], function (DependentField $field, ?GoalType $goalType) {
    if (!$goalType || $goalType->value == GoalType::BodyWeight->value) {
        return;
    }
    $field->add(EntityType::class, [
          'required' => true,
          'class' => Exercise::class,
          'choice_label' => 'name',
          'empty_data' => null,
          'placeholder' => '',
          'autocomplete' => true,
    ]);
})

What could be the reason?

Are you by any chance rendering this form in a live component? I have the same issue but only when rendering it through a live component. So I think the issue is not related to this bundle but the combination of Live Components and the Autocomplete package.

See symfony/ux#1261

@lgeorgiev
Copy link
Author

Yes, I am using the form in Live Component because of the real-time validation and dependent form fields.
Thanks for the link!

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

No branches or pull requests

2 participants