DataObjects Formbuilder - Trouble getting started
| From: | Sasha Sklar | Date: | Mon, 27 Feb 2006 23:10:20 +0000 |
| Subject: | DataObjects Formbuilder - Trouble getting started | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-23147@lists.php.net to get a copy of this message | ||
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);
//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