Re: HTML_Quickform_Controller Jump issue.

From: Date: Fri, 04 Jun 2004 10:31:28 +0000
Subject: Re: HTML_Quickform_Controller Jump issue.
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12895@lists.php.net to get a copy of this message
Ian P. Christian wrote: >-----BEGIN PGP SIGNED MESSAGE----- >Hash: SHA1 > >I'm using the function below as the action handler for Page0 in my multipage >wizard, however I can only seem to get jumps to page0 or page1 working, >jumping to any other page results in page1 (the next page) being shown. > >I have attached the function inline, and the entire form code as an >attachement (which quite possibly makes a good example that could be added to >the quickform_controller package, as it shows form pages that are created >dynamically depending on options from previous forms. > >Kind Regards, > >Ian > > class Page0ActionNext extends HTML_QuickForm_Action_Next > { > function perform(&$page, $actionName) > { > // save the form values and validation status to the session > $page->isFormBuilt() or $page->buildForm(); > $pageName = $page->getAttribute('id'); > $data =& $page->controller->container(); > $data['values'][$pageName] = $page->exportValues(); > $data['valid'][$pageName] = $page->validate(); > > // Modal form and page is invalid: don't go further > if ($page->controller->isModal() && !$data['valid'][$pageName]) { > return $page->handle('display'); > } > > $status = 1; > if ($status == 1) > { > $nextName = 'page0'; > } > elseif ($status == 2) > { > $nextName = 'page5'; > } > else > { > $nextName = 'pageUnavailible'; > } > $next =& $page->controller->getPage($nextName); > $next->handle('jump'); > } > } If you look at the statemachine example [1] (which IMO could be made easier), you will notice that in the Next action the 'valid' state is set to true in order to override the modal status of the page. As Alexey said, if the valid status is not set to true sometime, you won't be able to go any further in a modal controller. So : $data['valid']['pageX'] = true; in your Next action when needed. Bertrand Mansion Mamasam [1] <http://cvs.php.net/co.php/pear/HTML_QuickForm_Controller/examples/statemachine .php?r=1.2>

« previous php.pear.general (#12895) next »