After adding elements to my form, I get them rendered in a weird order, getting the submit button before one checkbox. Would appreciate hints on where to check for a quick fix.
class SomeForm extends My_Form {
public function init() {
$this->addElements();
//add a few elements (#1)
$this->addElements($otherForm->getElements());
//borrow some elements from another form (#2)
if ($trueCondition=true) {
$this->addElements();
//add one more element which will render at end of form (#3)
}
$this->addElements();
//some more, including submit button (#4)
parent::init();
//call My_Form to register custom decorator; culprit?
}
}
Output:
<inputs from addElements() #1 />
<inputs from addElements() #2 />
<inputs from addElements() #4 /> <-
<inputs from addElements() #3 /> <- mixed up order
All other forms using the custom decorator render elements in the order that they were added. I'm not posting the decorator as it's pretty messy. Hopefully the error lies elsewhere.
setOrder()somewhere? - LiyalisetOrder- bububabaaddElements()and they echo in order. @vascowhite -My_Formonly extendsinit(),isValid()andrender()(the latter because of custom decorator; it just renders value instead of label on the button and translates if translation available).addElements()is called for parent class, which is vanillaZend_Form- bububaba