Form entries positioning

Quick note on ordering form elements. It’s very useful specifically when you have complex form which consists of Doctrine table elements and some elements which is not included in Doctrine table (for instance dynamically generated form fields). By default symfony form framework uses the order you used in useFields method. So if you want to setup proper ordering for all form fields use setPositions method (it takes as argument array of field names):

$this->widgetSchema->setPositions(array(‘field1’, ‘field2’, ‘field3’));

Important note you should count in array every single form field (if you’d skip any of them – symfony throws error).

Leave a Reply

Your email address will not be published. Required fields are marked *