For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > February 2006 > Re: [PEAR] DataObjects Formbuilder - Trouble getting started









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] DataObjects Formbuilder - Trouble getting started
Justin Patrin

2006-02-27, 7:00 pm

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 =3D& DB_DataObject::factory('do_test');
>
>
>
> $do_testFB =3D& DB_DataObject_FormBuilder::create($do_te
st);
>
>
>
> // set up preferences for
>
> $form =3D& $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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com