Re: [QFC] applyDefaults and its behaviour ?

From: Date: Sat, 21 Jan 2006 09:19:27 +0000
Subject: Re: [QFC] applyDefaults and its behaviour ?
References: 1 2 3 4  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-41022@lists.php.net to get a copy of this message
Justin Patrin a écrit :
As I said, defaults are defaults. That's how they work, so setDefaults isn't going to work for you for resetting. I suggest asking the QF authors for a resetToDefaults() function and then asking the QFC authors to add their own function which calls this. -- Justin Patrin
Hi all, I've good news for all users ! No need to ask QF authors to add a new function. This function already exists. If you want to have such me a real RESET button that retrieve all defaults from start position before doing any actions on a QF controller, you should do : See Tabbed example in QFC package tabbed.php,v 1.3 2005/11/04 20:02:30 avb In this example add the following : class : TabbedPage method: addGlobalSubmit() note : add a new RESET button $this->addElement('submit', $this->getButtonName('reset'), 'RESET'); class : ActionProcess method: perform() note : manage reset action tips : loadValues(null) allow to remove submit values from a page of controller and give ability to controller->applyDefaults() method to do its standard job (constant applied then submit values applied (none here) then finally defaults applied)
        if ($actionName == 'reset') {
            $pageName = $page->getAttribute('id');
            $page->loadValues(null);
            $page->controller->applyDefaults($pageName);
            return $page->handle('display');
        }
note : add custom action $tabbed->addAction('reset', new ActionProcess()); Happy to find it : hope you'll all agree with this solution ! Laurent

« previous php.pear.dev (#41022) next »