Re: New package: DB_DataObject_FormBuilder
| From: | Alan Knowles | Date: | Tue, 26 Aug 2003 00:46:09 +0000 |
| Subject: | Re: New package: DB_DataObject_FormBuilder | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-20504@lists.php.net to get a copy of this message | ||
In the latest dataobject, setFrom, can also return an error array.. - eg. if you define a method
setDog($var) {
if (!in_array($this->dogTypes,$var)) {
return 'not a dog type';
}$this->dog = $var; return true; } Markus Wolff wrote:
Ron McClain wrote:-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.comOk, just making sure ;) Anyhow, I wonder if you could perhaps add a call to $this->_do->validate() in processForm? That way I can use my existing validation code for the extended DO classes.Hmm, I always do the call to validate() outside the class, in the main script: $obj =& new myDataObject); $fg =& DB_DataObject_FormBuilder::create($obj); $form =& $fg->getForm(); if ($form->validate()) {$form->process(array(&$fg,'processForm'), false);} How exactly would you want to implement it in the process method? Personally, I think the call to validate and triggering the process function should always stay out of a class, as its part of the script flow, not of the backend logic. But as always, I´m open to different opinions ;-) Regards, Markus