All Questions
Tagged with symfony4 symfony-forms
164 questions
0
votes
0
answers
52
views
Sonata AdminType fields are not validated
I have two admins UserAdmin and UserSettingsAdmin. In the UserAdmin I added a AdminType field that embeds UserSettingsAdmin form fields:
// AppBundle\Admin\UserAdmin.php
$formMapper
->add('...
-1
votes
2
answers
722
views
Validation password confirmation in Symfony
I have a problem when I try to create a validation of my registration form, I get an error
Invalid property path "passwordConfirmation" provided to "Symfony\Component\Validator\...
0
votes
1
answer
1k
views
Symfony 4 PRE_SET_DATA Event Listener setData not updating custom type fields
I have a parent form type which includes an unmapped child form type. The child form type contains three ChoiceType fields which are populated manually due to a specific formatting requirement.
The ...
0
votes
2
answers
2k
views
how to get the id of the current user in symfony? [duplicate]
i try to get the userId and the event ID to insert into ReservatonEvenement table in database but it give me an error of :Argument #1 ($ID_user) must be of type ?App\Entity\User, int given.
and when i ...
0
votes
0
answers
62
views
Symfony 4 save button to submit request keep reloading the current page
Actually there's no request sent as if the function isnt even executed
it already shows in the logs that it uses POST/SponsorNew and doesn't load "SponsorListPage"
after submitting save it ...
0
votes
2
answers
844
views
Symfony 4 : choiceType doesn't show choice_value correctly
I'm new with Symfony and I want to build a select option using choiceType.
So I add this code to buildForm method :
$builder->add('applications', ChoiceType::class, [
'choices' => [
'-- ...
0
votes
1
answer
169
views
Translated placeholder value not pulling through to Symfony 4 form field
{% trans_default_domain "admin" %}
{% form_theme leadForm _self %}
{{ form_row(leadForm.phonenumber) }}
My form field is defined as:
$builder
->add('phonenumber', TextType::...
0
votes
1
answer
655
views
How to show a different value for a field in a Symfony FormType
I have a Symfony FormType like this
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
class MyType ...
2
votes
1
answer
2k
views
Undefined class constant 'JSON_ARRAY'
(symfony4)So I create a database with the Laragon server then I create an entity with:
php bin / console make: entity
the entity was created but when I create a property name I got an error message:
...
0
votes
1
answer
430
views
Dynamic Form Modification
I am trying to create a dynamic form with two dynamic form elements.
I've followed the examples from https://symfony.com/doc/current/form/dynamic_form_modification.html#dynamic-generation-for-...
1
vote
2
answers
530
views
Symfony authenticator dosnt authenticat properly authenticator dosnt keep user after redirecting
Recently I was stuck in a bug and I have no idea why it doesn't work I hope u guys have an idea.
So the point is I wanna create a login for my admin so I create it entity \App\Entity\Admin, controller ...
1
vote
0
answers
929
views
Symfony Form Collections: How to prevent duplicate INSERT on EntityManager->flush()?
I have the following data model:
MainEntity.php
<?php declare(strict_type=1);
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*/
class MainEntity
{
// $id, etc...
...
1
vote
0
answers
108
views
Default template for ckeditor in symfony
My form builder looks like this:
...
$builder->add('answer', CKEditorType::class, [
'config' => [
'required' => true,
'extraPlugins' => '...
2
votes
0
answers
706
views
Set FormType's option dynamically, based on the data of a sibling FormType?
I have a Symfony Form with a custom ChoiceType that needs to filter the available choices, based on the value of another field (a sibling form-type inside the same form).
I am using EasyAdmin CMS that ...
1
vote
2
answers
2k
views
Symfony form doesn't change value by using FormEvents::PRE_SUBMIT
Following problem I have: In Symfony (Version 4.4.22) I created a FormType with a date-field and a checkbox. If the checkbox was checked then the field should get the value of "31.12.9999".
...