Questions tagged [symfony-forms]

The Symfony form component is a standalone library that can be used outside of Symfony projects.

Symfony form component provides tools for defining forms, rendering and mapping request data to related models. The component focuses on processing data to and from your client and application, whether that data be from a normal form post or from an API. Furthermore it provides integration with the Validation component.

Useful links

2507 questions
0
votes
0 answers

Symfony + Forms, by_reference = true and allow_add in CollectionType fields

I'm relatively new to Symfony, so I might grossly misunderstand something. I'm confused about when I'd want to set by_reference = true on a CollectionType form field with allow_add = true. For context: I got myself into this mess when I was trying…
janh
  • 2,516
  • 2
  • 18
  • 19
0
votes
1 answer

How to properply update an entity which contains an Image path?

I have a form that I use both for registration and edition of the user informations. This form contains a profile picture property on which I put @Assert\Image. I succeed in creating a new user through my registration form but when I try to edit…
0
votes
1 answer

How to make a DateIntervalType field in Symfony form not required

I have a DateIntervalType field: $builder ->add('effort', DateIntervalType::class, [ 'label' => false, 'required' => false, 'widget' => 'integer', 'input' => 'dateinterval', …
Michael Käfer
  • 952
  • 12
  • 27
0
votes
1 answer

Change Symfony Form Type element's form group CSS class

Briefly: I want to edit my form elements parent div class. In this code don't add or edit the css class to my target div (which is form-group) and the follow Form Type is an element of another Form Type. I have an Form Type like the follow: …
Mesuti
  • 743
  • 11
  • 26
0
votes
1 answer

How to edit and update json string using CollectionType

I have json string in my database. The string looks like [{"x":"1","y":"22"}]. So basically it stores two coordinates for a point. I want to be able to edit and save it using CollectionType form and data transformer. This is my Scene…
0
votes
0 answers

Symfony 4.3 : Dynamic form management

I'm trying to implement a dynamic form with Symfony 4.3 based on the official documentation. To simplicify, I have 3 entities: product, category and subcategory related to each other with OneToMany relationships as follows: a category can have…
MSK90
  • 21
  • 5
0
votes
1 answer

Symfony 4.3.5 - formbuilder and errors validation for update parent relation

I create VehicleType: class VehicleType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('name') ->add('user', EntityType::class, [ …
Pionas
  • 346
  • 4
  • 13
0
votes
0 answers

Symfony 4.2 DateTimeImmutable validator error

I'm using Symfony 4.2.11 on PHP 7.2 with this code:
tyteen4a03
  • 1,604
  • 19
  • 37
0
votes
1 answer

Reusing actions in symfony

Let's say we have an Article model and a Comment model. Article: columns: body: text Comment: columns: article_id: integer message: text relations: Article: local: article_id foreign: id foreignAlias:…
Dziamid
  • 10,081
  • 11
  • 62
  • 100
0
votes
0 answers

Symfony 4 form VichImageType update auto-fill

I have a symfony form for adding products to a Products entity. In this form I have a VichImageType field for uploading a product image. This all works fine, but when I go to update a product using the same for the VichImageType field is not filled…
0
votes
2 answers

Using Symfony forms, is there a way to persist unmapped field values to the database and retrieve them later to rebuild the form?

Using Symfony's form component, I have a "Report Settings" form with about 35 options and a few embedded forms. Is there a way to gather the selected options, persist them to a database, and then at a later date use those persisted options to…
Al B.
  • 33
  • 1
  • 7
0
votes
1 answer

symfony - populating multiple drop down select lists (AJAX) - UPDATED

I have a form, with 2 fields, that are select lists. I need to select an option from select_list_1 that then populates select_list_2 I have the following in my template: