score:3
Accepted answer
just add choice_attr
$form->add('keywords', choicetype::class, array(
'choices' => $keywords,
'label' => 'with following keywords',
'expanded' => true,
'multiple' => true,
'choice_attr' => function() {
return ['checked' => 'checked'];
},
));
Source: stackoverflow.com
Related Query
- Select all checkboxes in Symfony form view
- Multiple checkboxes with select all check box in symfony form builder
- Add a select all option to a list of checkboxes in symfony
- show children of parent like tree view on select menu in symfony form
- Symfony 2 Form with select list
- Symfony 2.5 : Entity Type, prevent fetching all records when form submitted
- Symfony Form: How to replace form class / retrieve all extra data?
- Symfony Doctrine - how to generate optgroup select form
- How to show font awesome icon in symfony form select
- Symfony 2 - Form select options database
- Symfony crawler select OPTION in SELECT list without FORM
- Twig : Get value of the entity attached to the form in twig view Symfony
- Set defaults for all Symfony Form Types
- Symfony 3.3 Form - EntityType field does not select option
- Symfony form builder default select by EntityType
- Display all form errors in twig symfony
- Explanation and all options for $options in Symfony form builder
- Fill select list in form with values from database + Symfony 2 & Doctrine
- How to Select From List of Objects in Symfony 2 Edit Object Form
- Symfony access form in all views
- How is symfony form rendered in the view
- How to add a custom default option to all form types in Symfony 5?
- How to add ng-model to Symfony form type checkboxes
- Symfony Form - Collection Type with Checkboxes inside
- Symfony forms, show ManyToMany relation as a list of checkboxes instead of a select
- How to add an attribute to the first select option in twig symfony form
- symfony 4 - Redirect after form select
- Processing form with multiple checkboxes using Symfony form component
- Symfony 2 form with multiple table select type
- Edit view of checkbox list in Symfony form
More Query from same tag
- Symfony2 - translatable field - The class 'Gedmo\Translatable\Entity\Translation' was not found in the chain configured namespaces
- Twig Loader prependPath not working
- Symfony 4 - User becomes null on callback from external API service
- Select objects with doctrine
- Symfony Test - Testing database with data to check Show($id) Feature
- Symfony: get new ID in a form
- Symfony swiftmailer delivery confirmation
- Having property of a same class in Symfony ApiPlatform
- SELECT [...] FROM (SELECT [...]) in DQL
- Symfony Error in Optional Form Field
- Symfony 2.2, Doctrine 2: Complex relational entity retrieval
- Symfony2 - Inheritance - repository find method
- twig using variables as hash key
- Payum Duplicate entry '0' for key 'PRIMARY'
- How do I configure my Twig / Symfony2 services for this?
- Empty relations when serializing with JMSSerializer
- Symfony PHPUnit self::$kernel is null in second test
- How do I specify default values in a Symfony form
- How can I set an attribute on individual select fields in date?
- Symfony2 doctrine and response
- VichUploaderBundle- expected argument of type "AppBundle\Entity\File", "Symfony\Component\HttpFoundation\File\UploadedFile" given
- symfony ldap always redirect to login page
- Symfony 4 user search by email issues
- Add a header when sending a message with php-enqueue and RabbitMQ
- Setting a default entity value
- PHPStorm is displaying warnings for imports that are used in annotations in Symfony project
- Symfony, why use `@`?
- Unrecognized options "class, property" under "security.providers.db_provider"
- PHP fatal error with phpunit on Symfony 3.3.8
- What is the difference between ACL and user roles in Symfony2