symfony-forms

how to split long symfony form in multiple pages?

偶尔善良 提交于 2019-12-18 02:47:55
问题 I want to create a form for an entity which has a many attributes. To ensure the ease of data entry, I want to split that form in multiple pages (for example 2 or 3 pages). Let's take the ad entity example: In page 1, the user will enter the ad text In page 2, the user will enter his contact In page 3, the user will provide the (X,Y) position of the ad This split will require saving the available data (inserting in the database) in the 1st page before moving to the next page. Unfortunately,

Problems With Multiple File Upload In Symfony2

心不动则不痛 提交于 2019-12-17 18:23:27
问题 I am making a Symfony2 application which needs to have a multiple image upload option. I have made the single file upload using the cookbook entry: How to handle File Uploads with Doctrine which works fine. I have implemented the lifecyclecallbacks for uploading and removing. Now I need to turn this into a multiple upload system. I have read a few answers from Stack Overflow as well, but nothing seems to work. Stack Overflow Question: Multiple file upload with Symfony2 multiple file upload

Symfony 2 : How to prevent multiple user editing the same form at the same time?

删除回忆录丶 提交于 2019-12-14 03:16:49
问题 On my SF application, i have "regular" form (generated with formType in controller). Let's say user1 edit the formA and it takes several minutes to fill it. In that period, user2 also edit the formA. You can guess, the last user that hit submit wins, and the other one looses all he filled. How can i prevent this from happening? This is not the case of a multiple submit (by the same user). I don't know if it's possible and how to best implement it, but my guess would be to add some "lock"

Sonata Admin - Custom AJAX call

蓝咒 提交于 2019-12-14 03:14:05
问题 I have created a custom list view in sonata admin to display a calendar. I'm trying to add events to the calendar dynamically, but I'm getting an error with the CSRF token being invalid. I have the following code: public function listAction() { if (false === $this->admin->isGranted('LIST')) { throw new AccessDeniedException(); } $datagrid = $this->admin->getDatagrid(); $formView = $datagrid->getForm()->createView(); // set the theme for the current Admin Form $this->get('twig')->getExtension(

Symfony2 custom form field

≯℡__Kan透↙ 提交于 2019-12-14 01:24:15
问题 I am very new to Symfony, so question might seem a little simple, but I need a help. I have generated new bundle. I have added a new route in Me\MyBundle\Resources\config\routing.yml : my_homepage: pattern: / defaults: { _controller: MeMyBundle:Default:index } Bundle controller looks in simple like this: namespace Me\MyBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class DefaultController extends Controller { public function indexAction() { $form = $this-

FormType duplicate formfield “name” conflict

倖福魔咒の 提交于 2019-12-13 22:05:55
问题 I have two properties with the same name from different tables declared in my GameType.php file. But these are actually not the same values as the table columns Game.name and Type.name come from different tables. How can I display both of them in the form without conflicts? Snippet from GameType.php: public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add( 'name', TextType::class, [ 'class' => 'AppBundle:Game', 'choice_label' => 'name', ] ); $builder ->add(

Customize SyliusFlowBundle render

人盡茶涼 提交于 2019-12-13 18:41:16
问题 I'm using Fuelux Wizard component for set up a wizard on my application. This is the HTML markup on my template: <div class="wizard" data-initialize="wizard" id="myWizard"> <ul class="steps"> <li data-step="1" class="active"><span class="badge">1</span>Step 1<span class="chevron"></span></li> <li data-step="2"><span class="badge">2</span>Step 2<span class="chevron"></span></li> <li data-step="3"><span class="badge">3</span>Step 3<span class="chevron"></span></li> </ul> <div class="actions">

Symfony 4. Why does submitted Form just partially populate the Model?

这一生的挚爱 提交于 2019-12-13 05:32:44
问题 A bit in the panic - I am generating Symfony form for a complex search, i.e. mapped data to the entity will be used just for a search query building. I create simple form, model, some extended types from ChoiceType for prepopulation choices by some logic. The form is submitted with GET method. In the model you find maker and model fields for example. The latter populated on the frontend with AJAX, after maker has been selected. When I do submit the form, and maker and model have non-default

How to make RadioButton in Symfony Form?

梦想的初衷 提交于 2019-12-13 04:08:26
问题 I have form that i have to redo with Symfony Form but i stuck on this place: <div class="currency-label"> <input checked id="cur1" name="currency" type="radio"> <label for="cur1">EURO</label> </div> <div class="currency-label active"> <input id="cur2" name="currency" type="radio"> <label for="cur2">USD</label> </div> This is how it looks: how to make radiobutton with Symfony Forms? In my form class i added: ->add('vacancyCurrency', RadioType::class, ['required' => false]) and to my template {

Editing form for relationship n:m with extra attributes between two entities

此生再无相见时 提交于 2019-12-13 04:08:20
问题 I have this mapping betwenn two entities: class Orders { // Other attributes /** * @ORM\OneToMany(targetEntity="OrderHasProduct", mappedBy="order") */ protected $orderProducts; // Other set/get methods public function getOrderProducts() { return $this->orderProducts; } } class Product { // Other attributes /** * @ORM\OneToMany(targetEntity="\Tanane\FrontendBundle\Entity\OrderHasProduct", mappedBy="product") */ protected $orderProducts; // Other set/get methods public function getOrderProducts