linioit / dynamic-form-bundle Goto Github PK
View Code? Open in Web Editor NEWGenerates symfony forms based on Yaml configuration files
Generates symfony forms based on Yaml configuration files
The FormlyFieldFactory
class is acting like a manager, and only returning new instances when one doesn't exist already. Instead, it should always be returning a new instance.
After following the example code in the README this is not working on symfony 4 or 5.
I get an error "cannot call method createForm on null", this I've noticed it can be fixed by adding a constructor in the DynamicFormAware trait like this
public function __construct() { $this->dynamicFormFactory = new FormFactory(); }
but then I get an error that the key "new_user" is not found, so I don't know where the form yaml should be put.
Could you update the doc and/or the bundle please ?
My form renders correctly and is a very simple configuration.
If i submit is neighter isSubmitted()
nor isValid()
do work.
dynamic_form:
new_user:
title:
enabled: true
type: text
password:
enabled: true
type: password
meta_keywords:
enabled: true
type: textarea
meta_description:
enabled: true
type: textarea
published:
enabled: true
type: checkbox
/**
* @Route("/", name="homepage")
*/
public function indexAction(Request $request)
{
// Create the dynamic form
/** @var \Symfony\Component\Form\Form $form */
$form = $this->get('dynamic_form.factory')->createForm('new_user');
$form->isSubmitted(); // never works. Not after submission.
// replace this example code with whatever you need
return $this->render('default/index.html.twig', array(
'form' => $form->createView(),
));
}
<form action="/" method="POST">
{{ form_widget(form) }}
<button type="submit" class="btn btn-primary">Speichern</button>
</form>
such as the following configuration, the units
is a subform of the suite_form
, does this bundle support this feature ?
forms:
suite_form:
form_options:
validation_groups: ['Default', 'api', 'my_group']
fields:
name:
description: "Name"
data_type: "text"
property_path: name
units:
data_type: collection
target_class: App\Entity\SuiteUnit
fields:
serviceTemplate:
data_type: text
target_class: App\Entity\ServiceTemplate
description: "Service template"
useCase:
data_type: text
target_class: App\Entity\UseCase
description: "Use case"
I have problems getting the choices-field to work.
It doesn't seem to work at all.
Do you have an example on how to configure it properly?
choice1:
type: choice
options:
choices:
- One
- Two
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.