Re: Quickform SetDefaults

From: Date: Tue, 06 Jan 2004 12:30:20 +0000
Subject: Re: Quickform SetDefaults
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-9994@lists.php.net to get a copy of this message
On Tue, 2004-01-06 at 01:43, Alexey Borzov wrote: > Hi! > > Barry Steele wrote: > > As you see I set the data after the fields are set. Essentially what I > > need to do is to try to clear any data that was held in the container - > > I thought "$this->controller->container(true);" - would do it. > > It usually does for me... I have a feeling that it is not really called. > > When is the method you posted (setValues()) called? Hi, I think I've regressed to presimian thought processes. My process goes like :- function _buildform { $this->_formBuilt = true; //create and add lots of elements $this->addElement('submit',$this->getButtonName('next'), 'Add Incident Data'); // add rules if (!$this->elementExists('action')) { $action = new HTML_QuickForm_hidden('action'); $this->addElement($action); } else { $action = $this->getElement('action'); } $action->setValue($_REQUEST['action']); if ($_REQUEST['action'] == 'edit') { echo "OK now we edit ".$_REQUEST['IncidentID']."<br>"; $incident = new incident(); $incident->find($_REQUEST['IncidentID']); if (!$incident) die( "Couldn't find Incident ".$_REQUEST['IncidentID']."<br>"); // replace with true error handling $id = new HTML_QuickForm_hidden('IncidentID'); $this->addElement($id); $this->setValues($incident); } else { echo "we don't have an edit - set values to null<br>"; $this->setValues(null); } Var_Dump::display($_REQUEST); Var_Dump::display($_SESSION); } The form has two Quickform_Pages and the setValues and I get the problem with setting values only after the first submit but the output from - Var_Dump::display($_REQUEST); Var_Dump::display($_SESSION); is -- Building Data Entry form we don't have an edit - set values to null Setting Values action String[3] (new) PHPSESSID String[32] (a4ebccf0de7a3bcab5cd0b91325748fe) valid_username String[11] (NSW_63_slsc) valid_password String[0] () valid_user_id String[2] (50) _Incident Mgt_container Array(4) + defaults Empty array () | constants Empty array () | values Array(2) | | + incident Empty array () | + resus Empty array () | + valid Array(2) | | + incident Null (Null) | + resus Null (Null) | I'm assuming that I'm doing this all backwards so I'd appreciate you're thoughts. Barry Steele hpfm solutions pty ltd mob: 0413947980 fax: 0299817727 mailto:: barry@hpfm.biz

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