symfony-forms Questions

5

Solved

I am reading tutorial here https://symfony.com/doc/current/form/csrf_protection.html how to add csrf token. It says to use form_end() in the template. But this is not working, gives error: ...
Spense asked 18/12, 2017 at 15:56

6

Solved

Is it possible to change an option of a field of an embedded form from the parent form? To illustrate the problem consider this: I have a parent form type class like this: class FruitFormType exten...
Stepdame asked 23/7, 2012 at 16:42

5

Solved

The Symfony MoneyType Field renders as input type="text" which allows a user to type whatever they want into the field. How can I override this to render as input type="number" so that users can o...
Bloomington asked 4/7, 2016 at 19:4

5

Solved

I've got a weird error. I implemented the Form component in my own system. There I created a FormType where I use the EntityType for a field. Everytime i wanna create the form with the formBuilder ...
Oblivious asked 4/3, 2018 at 22:40

3

Solved

So here is the scenario: I have a radio button group. Based on their value, I should or shouldn't validate other three fields (are they blank, do they contain numbers, etc). Can I pass all these v...
Hakon asked 13/5, 2015 at 6:4

2

Solved

Actually when I try to edit the form by sending empty fields, the above error comes on , My UserType class looks like: class UserType extends AbstractType { public function buildForm(FormBuilde...
Bodine asked 6/2, 2020 at 17:29

2

Solved

i have a entity called DynamicForm, which looks like this: <?php namespace App\Entity\Product\DynamicForm; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Doct...
Storytelling asked 21/5, 2021 at 8:45

10

Solved

In Twig template I check if a field has an error like this: {% if form.points.get('errors') is not empty %} Is there any method like: {% if form.points.hasErrors() %} to do it simpler? It's n...
Gabo asked 18/1, 2012 at 17:36

3

Solved

1 What i want to do is add custom (option is 'angular' in this case)option to my form widget template: {%- block widget_attributes -%} id="{{ id }}" name="{{ full_name }}" {%- if angular %} ng-...
Bungle asked 2/4, 2015 at 8:57

4

Solved

I need to send from Symfony form ChoiceType::class But I don't need choices keys, I need to send choices values. Is that is possible? $form->add('section', ChoiceType::class, array( 'mapped...
Decillion asked 25/10, 2016 at 17:11

4

Solved

I generate manually request content of my form and want to set data like: form[1][]=2&form[2][]=3&form[3][]=5&form[4][]=8&form[apply]= The Symfony Request object has an getConten...
Lenten asked 8/9, 2014 at 6:44

3

I need your advice with CollectionType field. I've made my collection type field using this: Symfony CollectionType Field Everything works fine. Even dynamic adding field with JQuery works properl...
Dual asked 21/8, 2017 at 13:1

3

Solved

I'm pretty new to symfony and symfony forms. I have a form with an EntityType, that looks like this: ->add('customer', EntityType::class, [ 'label' => 'Kunde: ', 'class' => Customer::c...
Beastings asked 29/1, 2018 at 15:8

5

Solved

I am using FOSUserBundle for managing my users. In order to register user, I reused the form of the bundle which meets my needs. Nevertheless, I needed to set some attributes of my fields. This is ...
Quickman asked 21/7, 2013 at 6:35

2

Solved

tl;dr: I need a custom validation constraint to run on an unmapped form field I need the ID of the object the form is manipulating to eliminate it from consideration doing my validation constrain...
Penholder asked 5/5, 2014 at 19:45

7

I'm using the Symfony2 country Field Type, it works well and country names are translated. I am storing the two-digit country code in the column country of my entity. How can I display the full, t...
Mezereon asked 23/3, 2012 at 22:8

2

Solved

I have OnetoOne relation between Users and Files, The problém is that every time i post a new file via embed form the validiation does not work . I tried this solution mentioned in symfony doc To p...
Greeley asked 19/7, 2017 at 13:17

3

Solved

With Symfony 2.7, you could customize a form's name in your EntityType class with the method getName() This is now deprecated. Is there another way to do that with Symfony 3.0 ? I have custom proto...
Farrah asked 3/5, 2016 at 13:40

3

I'm running Symfony 3.4 with FosUserBundle. I customized the registration form in order to get the Roles included : <?php $form->add('roles', ChoiceType::class, array( 'choices' => arr...
Informality asked 8/8, 2018 at 10:32

1

Solved

I'm trying to use Symfony Validator on a file upload form (form extension's validation) and I'm getting this error message: messageTemplate: "This value should be of type string." from Symfony\C...
Factotum asked 4/5, 2020 at 10:17

0

I have problem with soft delete item with form collection in Symfony framework I want to add and remove items in relation with Symfony form collection, If I remove item from collection this item m...
Spectrohelioscope asked 20/1, 2020 at 7:26

3

Solved

I get the following error when trying to pass through an option to my buildForm method in one of my forms. The option "numOfHoles" does not exist. Defined options are: "action", "allow_extra_fie...
Gallicism asked 26/10, 2015 at 10:49

6

Solved

UserType Form: class UserType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('email', 'email', ['label' => 'EMail']); // various other fields....
Dong asked 25/2, 2014 at 12:52

2

This is my first question on stackoverflow; until now I just looked for answers for my issues and found them. But now it seems that I have one that nobody or at least no one here stumbled across. ...
Intertidal asked 12/2, 2016 at 12:25

3

Solved

I have a controller getting a form posted. public function myPostAction(Request $request) { $form = $this->createForm('my_form', $my_object); $form->handleRequest($request); #... I can s...
Selfpreservation asked 18/2, 2015 at 18:52

© 2022 - 2025 — McMap. All rights reserved.