Więcej informacji znajdziesz tutaj oraz na

<?php
class PageableForm extends psPageableForm
{
public function setup()
{
$this->setNameFormat('form[%s]');
$this->setUseGlobalNamespace(false);
$form1 = new Form1(array(), array(), false);
$this->addForm($form1);
$form2 = new Form2(array(), array(), false);
$this->addForm($form2);
$form5 = new Form5();
$this->addForm($form5);
}
public function bind(array $taintedValues = null, array $taintedFiles = null)
{
$sex = $this->getSex($taintedValues);
if($sex == 'f' && !$this->isFormSet(3, 'Form3Female'))
{
$this->setForm(new Form3Female(array(), array(), false), 3);
$this->setForm(new Form4Female(array(), array(), false), 4);
}
elseif($sex == 'm' && !$this->isFormSet(3, 'Form3Male'))
{
$this->setForm(new Form3Male(array(), array(), false), 3);
}
parent::bind($taintedValues, $taintedFiles);
}
private function getSex(array $values)
{
if(isset($values['form2']['sex']))
{
return $values['form2']['sex'];
}
return null;
}
private function isFormSet($formPage, $formClass)
{
return $this->getForm($formPage) instanceof $formClass;
}
}
