The easiest way would (I think) to have two forms, a MyModule\Form\Step1
and a MyModule\Form\Step2
. The Step2
form accepts some input in the constructor which is depending on some data from step 1.
An example, you can do this with the service manager's factory:
'factories' => array(
'MyModule\Form\Step1' => function($sl) {
return new MyModule\Form\Step1;
},
'MyModule\Form\Step2' => function($sl) {
$request = $sl->get('Request');
$data = $request->getPost();
return new MyModule\Form\Step2($data);
}
),
If you GET
the page where the first one is displayed, then you POST
to the second page and finally POST
to the last page. During construction of the second form, you use the POST data and populate/construct the data as needed.