Re: DataObjects Formbuilder - Trouble getting started
| From: | Justin Patrin | Date: | Mon, 27 Feb 2006 23:20:54 +0000 |
| Subject: | Re: DataObjects Formbuilder - Trouble getting started | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23148@lists.php.net to get a copy of this message | ||
On 2/27/06, Sasha Sklar <spyrral@gmail.com> wrote:
> I'm trying to dive into Formbuilder. I've been using DB_DataObjects
> for a while now, with great results.
>
>
>
> The form displays, but hitting submit does nothing but display the
> frozen form. No row is inserted.
>
>
>
> Using the basic example from the docs and a table named "do_test",
> here's the code I've written:
>
>
>
> <?php
>
> // includes
>
> require_once // database connection string
>
> require_once 'DB/DataObject/FormBuilder.php';
>
>
>
>
>
> function fooBar() {
>
> print ('is this called?')
>
> return true;
>
> }
>
>
>
> $do_test =& DB_DataObject::factory('do_test');
>
>
>
> $do_testFB =& DB_DataObject_FormBuilder::create($do_test);
>
>
>
> // set up preferences for
>
> $form =& $do_testFB->getForm();
>
> if($form->validate()) {
>
> $form->process(array(&$do_testFB, 'fooBar'), false);
Ummm....why are you passing 'fooBar' here. This is why it's not
working. You should be passing 'processForm', as the docs and examples
say. 'processForm' is the function in FB that processes the form....
See: http://opensource.21st.de/19.html
>
> //this is optional, you can comment out this to make the
> form appear for editing again
>
> $form->freeze();
>
> } else {
>
> echo 'no validate for j00!';
>
> }
>
>
>
> echo $form->toHtml();
>
> ?>
>
>
>
> Do_test is just a auto_increment key and a single varchar field. Can I
> get a hint?
>
>
--
Justin Patrin