This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

collection forms without javascript

Notes and reports about symfony 1.0.x stable

collection forms without javascript

by jan.kopacek » Wed Jul 06, 2011 2:05 pm

Hello, please can you tell me, how can I render collection form only with php? I have this part collection
Code: Select all
$builder->add('jobName');       
        $builder->add('jobParts', 'collection', array(
                'type'       => new JobPartType(),
                'allow_add'    => true,
                'allow_delete' => true,
        ));

and twig template
Code: Select all
{% for jobPart in form.jobParts %}      
      <tr>
        <td>
            {{ form_widget(jobPart) }}
            {{ form_errors(jobPart) }}
        </td>       
       </tr>
   {% endfor %}

than I have external data, and I need to render form accordingly, so I need to have something like this
Code: Select all
{% for name in names %}
   <input type="number" id="jobPart_$$name$$_count" name="order[items][$$name$$][count]" required="required" value="" />
{% endfor %}

Thank you very much!
jan.kopacek
Junior Member
 
Posts: 10
Joined: Sun Jul 03, 2011 9:58 pm