Re: Package proposal: HTML_QuickForm_Controller
| From: | Greg Beaver | Date: | Thu, 28 Aug 2003 21:56:07 +0000 |
| Subject: | Re: Package proposal: HTML_QuickForm_Controller | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-20781@lists.php.net to get a copy of this message | ||
Hi Alexey,
In Controller::handle(), I would suggest modifying the code so that users can use their own custom actions.
first, move:
$className = 'HTML_QuickForm_Action_' . $actionName;
to before the switch() statement.
then, in the default:, add this code:
if (class_exists($className)) {
$this->_actions[$actionName] = &new $className;
return $this->_actions[$actionName]->perform($page, $actionName);
}
In this way, users can include custom actions without forcing them to be installed in PEAR.
I'm still +1 after a thorough look at the code (don't count me twice, just in case). This is good stuff.
:)
Greg
Alexey Borzov wrote:
Hi! This is an add-on to HTML_QuickForm package which (as the name suggests) behaves like a Controller from MVC design pattern. It receives the name of the action from HTTP request data and calls the appropriate handler. This allows, among other things, to build multipage forms, demos are available: 1) Wizard: http://oc.cs.msu.su/pear/wizard.php 2) Tabbed form: http://oc.cs.msu.su/pear/tabbed.php The package handles storing form data in session between requests and validating the form as a whole. It includes the default handlers for common events to allow quick building of multipage forms. Download package (installable via PEAR installer): http://oc.cs.msu.su/pear/HTML_QuickForm_Controller-0.1.tgz Source code 1) Base classes http://oc.cs.msu.su/pear/HQC/Controller.phps http://oc.cs.msu.su/pear/HQC/Page.phps http://oc.cs.msu.su/pear/HQC/Action.phps 2) Default action handlers http://oc.cs.msu.su/pear/HQC/Back.phps http://oc.cs.msu.su/pear/HQC/Direct.phps http://oc.cs.msu.su/pear/HQC/Display.phps http://oc.cs.msu.su/pear/HQC/Jump.phps http://oc.cs.msu.su/pear/HQC/Next.phps http://oc.cs.msu.su/pear/HQC/Submit.phps 3) Examples http://oc.cs.msu.su/pear/HQC/simple.phps http://oc.cs.msu.su/pear/HQC/wizard.phps http://oc.cs.msu.su/pear/HQC/tabbed.phps This is exactly what should be called a subpackage for QuickForm and is proposed separately because the code is of beta quality and needs further testing while QuickForm itself is stable.