How would one go about having a multi step type form with zend. This is what I’m trying to do..
Normally I have a form, the user fills the form. When the form is submitted (post) AND is valid, I do the final action (add to the database or anything else).
public function indexAction(){
$form = new Application_Form_Test();
if(form is valid){
//do the final thing.. add to the database or whatever
}
$this->view->form = $form;
}
What I want to do is insert a middle step. When the user submits the form, I don’t want to insert into the database right away. I want to first calculate some additional data, show the calculated data to the user in addition to the input he just entered, and display a confirm button. If the user presses submit, I do the final thing which is add to the database, otherwise I cancel out of the whole operation. So can someone think of a simple way to do this without doing a lot of crazy hacking?
I prepared a draft of a possible way to overcome your problem. Basically it involves two actions (indexAction and index2Action) and a session.
indexAction
index2Action
What do you think?