HTML::QuickForm::Controller - Adding pages dynamically,

From: Date: Thu, 21 Apr 2005 11:48:38 +0000
Subject: HTML::QuickForm::Controller - Adding pages dynamically,
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-18862@lists.php.net to get a copy of this message
Dear all, I wish to generate a quickform controller pattern where pages are added on the fly. As an example, the first page would ask the user "how many pages would you like". The "Next" action of this first page would then add a number of new pages to the form and jump to the first of these. An outline of the approach follows: class PageAddRecord extends HTML_QuickForm_Page { function buildForm() { ... usual form building stuff } } class PageFirstActionNext extends HTML_QuickForm_Action_Next { function perform(...) { .. blah blah $pageNew =& new PageAddRecord('record'); $page->controller->addPage($pageNew); $next =& $page->controller->getPage('record'); $next->handle('jump'); } } $page1 =& new PageFirst('FirstPage'); $wizard =& new HTML_QuickFormController('Wizard'); $wizard->addPage($page1); $page1->addAction('next', new PageFirstActionNext()); This fails to work as expected. While a form is created called 'record' and jumped to, it's just a copy of PageFirst, PageAddRecord->buildForm() is not called. I have a feeling that this approach is not the best way to achive what I want to do (if it doesn't work it's probably not wise to try and force it). If there is an easier way please advise me. Many thanks, =ed

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