Category : symfony-forms

I am having issues overriding a label in my form in my Symfony 4.4 application: {{ form_row(form.legal, { ‘label’ : ‘personal.form.fields.legal’|trans }) }} personal.form.fields.legal looks like this: I agree that I am 18 and above, I have read and accept the <a href="/terms-cond">T&Cs</a> My form definition: ->add(‘legal’, CheckboxType::class, ‘required’ => true, ‘mapped’ => false, ]) ..

Read more

I have a simple contact form. Within the form I would like to change the color of the help text In FormType I added i. e. the name field: $builder ->add(‘name’, TextType::class, [‘help’ => ‘Pflichtfeld’]) In Twig I have this: <div class="row"> <div class="col"> {{ form_label(ContactForm.name)}} {{ form_widget(ContactForm.name) }} {{ form_help(ContactForm.name, {‘help_attr’: {‘class’:’text-danger’}}) }} </div> ..

Read more

i was createing a new databse for my project and this problem appeared to me php bin/console doctrine:database:create In AbstractPostgreSQLDriver.php line 79: An exception occurred in driver: could not find driver In PDOConnection.php line 31: could not find driver In PDOConnection.php line 27: could not find driver doctrine:database:create [-s|–shard SHARD] [-c|–connection [CONNECTION]] [–if-not-exists] [-h|–help] [-q|–quiet] ..

Read more

I’m persisting many to one relation into mysql, but i’m facing an issue with populating checkboxType in update function because I stored all CheckBoxType as string in MySQl. I tried following ,but it didn’t worked. $data = $this->getDoctrine()->getRepository(Item::class)->find($id); $sizes = filter_var($size, FILTER_VALIDATE_BOOLEAN); $form = $this->createForm(ItemType::class, $data); Following is the class: item /** * @ORMColumn(type="string", length=255) ..

Read more

So I have installed ApiPlatform on my project and have a Task.php entity on it as a resource. How can I use my Task api resource’s endpoints when a form is submitted? I am considering using httpclientinterface, but there is no way to retrieve submitted values without $form->handleRequest($request) ProjectController.php public function new(HttpClientInterface $client, Request $request): ..

Read more

I am using the bootstrap form theme and I am trying to render each form collection field like this: https://getbootstrap.com/docs/4.0/components/input-group/#checkboxes-and-radios When I call {{ form_widget(inputs[‘values’]) }} BS form dumps the input, label, help text and errors. This is great but I need to change the position of the help text, without overriding a bunch of ..

Read more

I have two entities, client and order. I have an admin interface where I show all the orders of a client, where I can modify or delete every order. To do that I use a Collection Type: My controller: $form = $this->createForm(ClientConfigType::class, $client); This is my ClientConfigType : <?php namespace AppForm; use AppEntityClient; use SymfonyComponentFormExtensionCoreTypeCollectionType; ..

Read more