Ticket #98 (closed defect: fixed)

Opened 10 months ago

Last modified 2 months ago

Form helper does not close groups unless explicitly told

Reported by: clay@killersoft.com Assigned to: pmjones
Priority: major Component: code
Keywords: Cc:

Description

Based on some of the Solar code I've seen in the wild (ahem), it is not uncommon for Solar_View_Helper_Form use for groups to be started, but not finished.

For example:

<?php echo $this->form()
  ->beginFieldset($this->getTextRaw('LEGEND_EDIT'))
  ->auto($this->acl_form)
  ->beginGroup()
  ->submit(array('name' => 'process', 'value' => $this->getTextRaw('PROCESS_SAVE')))
  ->endFieldset()
  ->fetch();

In that example, pasted from some in-production Solar code, the group containing the form action buttons is opened with beginGroup(), but no endGroup() method is called.

I like that style, and don't have a problem with it. The issue is that the </dd> element is not auto-generated in that example at the end of the group.

Solution:

if ($in_group) {
    $form[] = '            </dd>';
}

on/around line 654 in Solar_View_Helper_Form, as part of the fetch() method -- as the first check after looping through $this->_stack.

Without that change, forms with groups done in this manner are not XHTML-compliant.

Attachments

Change History

05/03/08 15:38:59 changed by pmjones

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in [3145]. Thanks Clay. :-)


Add/Change #98 (Form helper does not close groups unless explicitly told)




Action