ataObject_FormBuilder: help with where to add function to make field a textarea?
| From: | l Burnerheimerton | Date: | Tue, 04 Jan 2005 18:49:15 +0000 |
| Subject: | ataObject_FormBuilder: help with where to add function to make field a textarea? | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-16596@lists.php.net to get a copy of this message | ||
Here's the code I was advised to use - obviously, I am very new still to formbuilder but REALLY
want to use it.
"Look at textFields.
in the DO:
var $fb_textFields = array('textField1', 'textField2');
You can change their sizes in postGenerateForm
in the DO:
function postGenerateForm(&$form) {
$el =& $form->getElement('textField1');
$el->setCols(40);
$el->setRows(20);
}"
And here's the code to the form:
<?php
define('DB_DATAOBJECT_NO_OVERLOAD', 1);
require_once('DB/DataObject.php');
require_once('DB/DataObject/FormBuilder.php');
$config = parse_ini_file('../djjdir/db_dataobject.ini', true);
foreach($config as $class => $values) {
$options = &PEAR::getStaticProperty($class, 'options');
$options = $values;
}
$building = DB_DataObject::factory('userAddition');
if (PEAR::isError($building)) {
die($building->getMessage());
}
$builder =& DB_DataObject_FormBuilder::create($building);
if (PEAR::isError($builder)) {
die($builder->getMessage());
}
if (PEAR::isError($builder)) {
die($builder->getMessage());
}
$form =& $builder->getForm();
if (PEAR::isError($form)) {
die($form->getMessage());
}
if ($form->validate()) {
$form->process(array(&$builder,'processForm'), false);
echo 'New buidler ID: '.$builder->bldg_ID;
}
echo $form->toHtml();
?>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com