Re: New package: DB_DataObject_FormBuilder

From: Date: Mon, 25 Aug 2003 13:45:56 +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-20500@lists.php.net to get a copy of this message
That's the quickform validation. Before actually inserting of updating, it would be helpful if data_object validation were run. There's an actual DB_DataObject->validate() call that has nothing to do with QuickForm->validate(). See the DataObjects documentation. Let me know if this still doesn't make sense ;) -Ron Markus Wolff wrote:
Ron McClain wrote:
Ok, 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


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