Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.2.16

Bug #1516 No use of separators when setGroupTemplate
Submitted: 2004-05-27 12:48 UTC
From: ths at php dot net Assigned: avb
Status: Closed Package: HTML_QuickForm
PHP Version: Irrelevant OS: WinXP
Roadmaps: (Not assigned)    
Subscription  


 [2004-05-27 12:48 UTC] ths at php dot net
Description: ------------ On using setGroupTemplate() the separators from addGroup() have no effect. Here is the fixed method finishGroup in Renderer/Default.php. Sorry for not providing a diff, but Default.php is unfortunally binary in CVS. /** * Called when visiting a group, after processing all group elements * * @param object An HTML_QuickForm_group object being visited * @access public * @return void */ function finishGroup(&$group) { $separator = $group->_separator; if (is_array($separator)) { $count = count($separator); $html = ''; for ($i = 0; $i < count($this->_groupElements); $i++) { $html .= (0 == $i? '': $separator[($i - 1) % $count]) . $this->_groupElements[$i]; } } else { if (is_null($separator)) { $separator = ' '; if (!empty($this->_groupWrap)) { $separator = ''; } } $html = implode((string)$separator, $this->_groupElements); } if (!empty($this->_groupWrap)) { $html = str_replace('{content}', $html, $this->_groupWrap); } $this->_html .= str_replace('{element}', $html, $this->_groupTemplate); $this->_inGroup = false; } // end func finishGroup Reproduce code: --------------- require_once 'HTML/QuickForm.php'; $form =& new HTML_QuickForm('frmGroups'); $renderer =& $form->defaultRenderer(); // Setting special template for group element $renderer->setGroupTemplate('<table border="1"><tr>{content}</tr></table>', 'group'); $renderer->setGroupElementTemplate('<td>{element}</td>', 'group'); // Creates a checkboxes group using an array of separators $boxes = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'); foreach ($boxes as $box) { $checkbox[] = &HTML_QuickForm::createElement('checkbox', $box, null, $box); } $form->addGroup($checkbox, 'group', 'ABC...', array ('', '', '', '</tr><tr>')); $form->display(); Expected result: ---------------- New table row after the 4. element. Actual result: -------------- The separators have no effect.

Comments

 [2004-05-27 13:16 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2004-05-27 17:29 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2004-06-09 15:14 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!