I have a form that contains 5 sub-forms of the class A, and another sub-form of the class B.
I want to show in the view first the sub-forms of the class A but I don’t know how to retrieve only them.
Should i create another sub-form that contains the 5 sub-forms of the class A?
Is there any way to get the sub-form based on a pattern?
I’m instanting the forms in the controller like this:
for($i = 0; $i < 6; $i++)
{
$form = new ContractLink_Form_ContractOMFOverrideAppendix();
$form->setElementsBelongTo('override' . $i);
if(isset($overrides[$i])) {
$form->populate($overrides[$i]);
}
$formSuper->addSubForm($form, 'OMFOverrideAppendixForm' . $i);
}
I’m using zf1.
As said on IRC,
You could use the instanceof PHP operator to check the class of the subform.