For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > February 2006 > 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 DataObjects Formbuilder - Trouble getting started
Sasha Sklar

2006-02-27, 7:00 pm

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);

//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?


--
Sasha Sklar
http://www.spyrral.net/
spyrral@gmail.com
Sponsored Links







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

Copyright 2008 codecomments.com