Thursday, 15 January 2015

php - Mix forms in twig Symfony2 -



php - Mix forms in twig Symfony2 -

i utilize twig , symfony2. want mix forms (i need multiple forms).

the entity construction is: main-meal(name, date, ...), dessert(name, date, ...).

the html construction should this:

-> day1: form1.food1, form2.food1

-> day2: form1.food2, form2.food2

-> day3: form1.food3, form2.food3

...

form1 main meal form2 dessert

any thought how this? here code 1 meal (withoud dessert - form2).

{% block body %} <h1>neuen essensplan eintragen</h1> {{ form_start(form1, {attr: {class: 'form-inline'}}) }} montag: {{ form_widget(form1.name, { 'attr': {'class': 'foo'}, 'attr': {'placeholder': 'hauptgericht'} }) }} {{ form_widget(form1.zusatzstoff, { 'attr': {'class': 'hide'} }) }} {{ form_widget(form1.datum.day, { 'attr': {'class': 'hdide'}, 'value': datum[0].day }) }} {{ form_widget(form1.datum.month, { 'attr': {'class': 'hdide'}, 'value': monat }) }} {{ form_widget(form1.datum.year, { 'attr': {'class': 'hdide'}, 'value': jahr }) }} {{ form_widget(form1.submit, { 'attr': {'class': 'hide'} }) }} {{ form_end(form1) }} {% endblock %}

thanks!

yes can utilize multiple forms. trying do, "collection type want do.

php forms symfony2 doctrine

No comments:

Post a Comment