Re: QF/QFC: a question and a request

From: Date: Tue, 16 Dec 2003 14:57:41 +0000
Subject: Re: QF/QFC: a question and a request
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-9583@lists.php.net to get a copy of this message
<m.bariola@redlinkitalia.it> wrote : > Hello, > > keeping working on QFC, I was wondering what's the best way to unset > the defaults for a controller. > > this is my situation: I get to the QFC page like this: > > http://blahblah...../myController.php?someparameters=parametervalues > > I look at those parameters in $_GET array to load up a data object > from the DB and then setDafaults/applyDefaults to the controller/pages. > > running this page on IE and opera, I also would like that if I call > > http://blahblah...../myController.php > > without parameters, no defaults be loaded and the forms present > themselves empty. > > Looking at the controller::setDefaults() code, > > function setDefaults($defaultValues = null) > { > if (is_array($defaultValues)) { > $data =& $this->container(); > $data['defaults'] = array_merge($data['defaults'], > $defaultValues); > } > } > > it seems there is no way to actually instruct it to delete the > defaults from a "previous" use of ....myController.php . > > I do it now by directly playing with the container's ['defaults'] > array. But -- how about adding an optional parameter to > setDefaults(), which, if set, actually clears the defaults for the > Controller? > > Also, adding the possibility for applyDefaults() to apply to all the > pages of a Controller if a pagename isn't specified could be a > timesaver. > > Thanks for your attention (and patience), I personally use : if (!empty($_GET['somevar'])) { $controller->container(true); } The parameter set to true will reinitialize your container, thus unsetting any previous validation, defaults, constants, submitted values states. Bertrand Mansion Mamasam

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