-- Mary Nicole Hicks <webmas...@marynicolehicks.com> wrote (on Wednesday, 15 July 2009, 10:38 PM -0700): > I am finding the Zend_Form hard to use. Currently all form elements usable in > a Zend_Form have "order" property that specify an integer. This number is > used to sort the form elements. > > The problem I have is that I have extended the implementation of a form > several times. In an extending class, I wish to insert an elements in > between 2 existing elements. > > Currently this means that if in the element before has an order number of 5 > and the element after has an order number of 10, the element I want to > insert needs to have an order number of 7 or so. After extending a few > times, the order numbers get hard to keep track of. If you have items with > order numbers of 5 and 6, then you can not seem to place an element in the > middle.
So, since you know all the elements in your form presumably... why not simply set the order after all elements are defined? $this->foo->setOrder(1); $this->bar->setOrder(2); $this->baz->setOrder(3); This allows you to specify the full order in each extending class, which gives you even more flexibility. > Does anyone have code, or do people think code could be added to Zend_Form > to the following: > - $Zend_Form->InsertAtBeginning(Zend_Form_Element) > - $Zend_Form->InsertBefore(Zend_Form_Element1,Zend_Form_Element2) > - $Zend_Form->InsertAfter(Zend_Form_Element1,Zend_Form_Element2) > - $Zend_Form->InsertAtEnd(Zend_Form_Element) If you look into the code for Zend_Form, it's complex -- and I think that instead of adding features like this to the API, it makes more sense to do this in your own extending classes, or to use the technique I outline above. -- Matthew Weier O'Phinney Project Lead | matt...@zend.com Zend Framework | http://framework.zend.com/