I have a problem with validation when I try to make a form which upon
a first submit
will render a second conditional form.
The rendering works all wright but only the first form seem to validate.
What have I thought wrong here.
In pseudo-code:
create element hidden with name 'choose' and value 'OK'
create element radiobutton with name 'director' and values 'dexists' and 'dnew'
create element select populated with directors and with name 'dir_id'
create element text with name 'name'
create element submit
create form with method post and add elements 'choose', 'director' and submit
if (!isset($_POST['choose'])
{
echo $form;
} elseif (!isset($_POST['add'])) {
create element hidden with name 'add' and value 'OK'
if ($_POST['director'] =='dexists')
{
add element 'dir_id'
} elseif ($_POST['director']=='dnew')
add element 'name'
}
echo $form;
} else {
if ($form->isValid($_POST)
{
$values = $form->getValues();
print_r($values);
} else {
echo $form;
}
}
As I said it renders both forms correct but does'nt have any other
values in $values than those from the first form.