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

Request #3796 Groups always rendered as last
Submitted: 2005-03-12 21:20 UTC Modified: 2006-12-16 02:21 UTC
From: xolphin Assigned: justinpatrin
Status: Closed Package: DB_DataObject_FormBuilder
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    

 [2005-03-12 21:20 UTC] xolphin
Description: ------------ Groups generated with preDefGroups are always rendered as last, after all other fields. FormBuilder should render the fields in the order described by preDefOrder (or if this isn't used, in the order they appear in the database).


 [2005-03-12 23:32 UTC] justinpatrin
This is not a bug, it's a feature request. Since there are multiple fields in the groups, which one should it use to choose where the group should be? It could be possible to use the group's name in preDefOrder to specify where it should go...would this work. You can also move the group (or any element) after the form is created with the insertElementBefore method. Here's an example (add this to your DO class): function postGenerateForm(&$form) { $form->insertElementBefore($form->removeElement('groupName'), 'elementToPutGroupBefore'); }
 [2005-03-13 04:11 UTC] xolphin
If no preDefOrder is specified, I think it should add the group when it runs into the first field of the group, and add the other fields from the group in the order they appear in the database or in preDefOrder. Using the group's name in preDefOrder would be very nice, I hope this can be implemented. Until then I can use your workaround, I didn't know that was possible. I think it is a good thing if such things are added to the help file too.
 [2005-03-15 13:38 UTC] justinpatrin
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on In case this was a website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better. I think I implemented everything here. You can place the name of the group in preDefOrder, and if it's not specified in preDefOrder (or there is no preDefOrder) the group will be where the first element it contains would normally be.