Re: can't get [PEAR] DB_DataObject_FormBuilder to build a form
| From: | Justin Patrin | Date: | Thu, 23 Dec 2004 18:17:07 +0000 |
| Subject: | Re: can't get [PEAR] DB_DataObject_FormBuilder to build a form | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-16434@lists.php.net to get a copy of this message | ||
On Thu, 23 Dec 2004 09:58:45 -0800 (PST), l Burnerheimerton
<lburnerheimerton@yahoo.com> wrote:
> I am using version 4.3.8 - I can change that if needed but as a last resort.
>
> I added that line in as specified and it gave the same error:
> "Fatal error: Call to undefined function: getform() on .... line 14"
>
> Line 14 in the code is:
> form =& $builder->getForm();
>
> Thanks for any help or links or recommended reading or code or...
>
> Merry Christmas.
>
>
> Justin Patrin <papercrane@gmail.com> wrote:
> On Thu, 23 Dec 2004 03:55:42 -0800 (PST), l Burnerheimerton
> 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.
> >
> >
> 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');
Try adding some error checking.
if (PEAR::isError($review)) {
die($review->getMessage().' '.$review->getUserInfo());
}
> > $builder =& DB_DataObject_FormBuilder::create($building);
I *know* tha this one is failing, but it is likely be failing due to
$review not being correct.
if (PEAR::isError($builder)) {
die($builder->getMessage().' '.$builder->getUserInfo());
}
> > $form =& $builder->getForm();
> > if ($form->validate()) {
> > $form->process(array(&$builder,'processForm'), false);
> > echo 'New buidler ID: '.$builder->bldg_ID;
> > }
> > echo $form->toHtml();
> > ?>
> >
> >
>
> --
> Justin Patrin
>
--
Justin Patrin