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

[Form] "empty_value => true" and "required => false" won't render an empty value for document Field Type #2802

Closed
mrohnstock opened this issue Dec 8, 2011 · 2 comments

Comments

@mrohnstock
Copy link
Contributor

$builder->add('name', 'document', array('class' => 'test\TestBundle\Document\Name', 'multiple' => true, 'empty_value' => true, 'required' => false, 'label' => 'Name:', 'query_builder' => function(DocumentRepository $dm) { return $dm->createQueryBuilder()->sort('name', 'asc');},));

Will render all documents, that got fetched by query_builder, but not an empty value in select-form-field.
Only setting 'required' => false or 'empty_value' => true results to the same issue.

Tested with 2.0.6 and 2.1.0-dev (from today).

@mrohnstock mrohnstock reopened this Dec 8, 2011
@mrohnstock
Copy link
Contributor Author

adding the following to the twig-view, creates the empty value:

{{ form_widget(form.name, { 'empty_value' : '' }) }}

but choosing the empty value makes the form invalid.

@stof
Copy link
Member

stof commented Dec 8, 2011

The document type is provided by DoctrineMongoDBBundle so please open the issue there instead.

Btw, we are currently refactoring the Doctrine bridge to make it more generic so the MongoDBBundle will soon be able to reuse the classes from the bridge which have been updated to handle the empty value.

@stof stof closed this as completed Dec 8, 2011
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