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
Default value on entity autocomplete #397
Comments
You can set the default values like with other Symfony forms too. Since your field is mapped to an entity, you will have to pass an entity to populate it. Based on the example in the docs: $member = $em->find('AppBundle\Entity\Member', 1);
$filterForm = $this->get('form.factory')->create(new MemberFilterType());
$fFilterForm->setData(array(
'member' => $member
)); Close? |
I'm not sure to understand this: will it fill the form with the first element of my repository, or with the first element in the autocompletion list ? Pierre Olivier TRAN06.79.63.36.78fr.linkedin.com/in/potran Date: Tue, 14 Jul 2015 06:08:51 -0700 You can set the default values like with other Symfony forms too. Since your field is mapped to an entity, you will have to pass an entity to populate it. Based on the example in the docs: https://github.com/genemu/GenemuFormBundle/blob/master/Resources/doc/jquery/autocomplete/entity.md
Close? — |
Sorry, we are talking about different things. My answer is regarded to setting "default values". |
yes, I'm sorry, I'm new to this bundle, I have to admit it is amazing, altough I still don't get all of it's awesomeness :). Pierre Olivier TRAN06.79.63.36.78fr.linkedin.com/in/potran Date: Tue, 14 Jul 2015 06:28:08 -0700 Sorry, we are talking about different things. My answer is regarded to setting "default values". Your problem seems to be with your javascript on client side. — |
Hello,
Is it possible to "force" a choice on entity autocomplete ?
Let's say, I got a City entity. If I type Pari , My list will automatically display "Paris" as a choice. Unfortunately, if I immediately press Tab to get to the next form input, the Autocomplete will just remain on "Pari", and pop an error on form submit (Impossible to access an attribute ("name") on a NULL variable ("")). '
How can I force the input to select the first displayed result ?
The text was updated successfully, but these errors were encountered: