Re: can't get [PEAR] DB_DataObject_FormBuilder to build a form

From: Date: Thu, 23 Dec 2004 16:08:07 +0000
Subject: Re: can't get [PEAR] DB_DataObject_FormBuilder to build a form
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16430@lists.php.net to get a copy of this message
On Thu, 23 Dec 2004 03:55:42 -0800 (PST), l Burnerheimerton <lburnerheimerton@yahoo.com> wrote: > > I spent all day going throuigh and getting [PEAR] DB_DataObject to work - hurray! Pretty cool > stuff. I want to go the next step and make form generation a common practice of mine which means I > need to learn DB_DataObject_FormBuilder. > > I think I am missing something fundamental. Does DB_DataObject_FormBuilder create forms on the > fly whenever you need them but they are never any permanent files OR are they auto-generated one > time into actual file that you then you customize? > > Below is the code I found as an example and used but it did not work even after hours of > changing varables. > > I have gone through every documentaion I can find. > > What am I missing in terms of the code below and in my understanding of > DB_DataObject_FormBuilder? > > The error is: > Fatal error: Call to undefined function: getform() in line 13 Are you using PHP 4.3.10 perhaps? > > Thanks for ANY help. > > <?php Add this line here: define('DB_DATAOBJECT_NO_OVERLOAD', 1); > require_once('DB/DataObject.php'); > require_once('DB/DataObject/FormBuilder.php'); > $config = parse_ini_file('db_dataobject.ini', true); > foreach($config as $class => $values) { > $options = &PEAR::getStaticProperty($class, 'options'); > $options = $values; > } > $_DB_DATAOBJECT_FORMBUILDER['CONFIG'] = > $config['DB_DataObject_FormBuilder']; > > $review = DB_DataObject::factory('building'); > $builder =& DB_DataObject_FormBuilder::create($building); > $form =& $builder->getForm(); > if ($form->validate()) { > $form->process(array(&$builder,'processForm'), false); > echo 'New buidler ID: '.$builder->bldg_ID; > } > echo $form->toHtml(); > ?> > > -- Justin Patrin

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