Development

Forms

You must first sign up to be able to contribute.

Fieldset

It is sometimes useful to group fields in a long form into HTML fieldsets. Some fieldsets may be rendered collapsed and expandable.

After reading forms for web designers, I understand that one of the features of the symfony forms system is strong separation between form development and form design. I suspect that fieldsets are on the design side, so the correct way to add fieldsets to a symfony form is:

<?php echo $form->renderFormTag(url_for(array('module' => 'contact'))) ?>
  <fieldset class="collapsible collapsed">
    <legend>Foo</legend>
    <?php echo $form['name']->renderRow() ?>
    <?php echo $form['email']->renderRow() ?>
  </fieldset>
  <fieldset>
    <legend>Bar</legend>
    <?php echo $form['subject']->renderRow() ?>
    <?php echo $form['message']->renderRow() ?>
  </fieldset>
  <input class="form-submit" type="submit" />
</form>