Formbuilder refuses to save checkbox value
| From: | roland cruse | Date: | Mon, 02 Jan 2006 22:37:21 +0000 |
| Subject: | Formbuilder refuses to save checkbox value | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-22408@lists.php.net to get a copy of this message | ||
Hello
I can't get Formbuilder to save a checkbox value. I've seen some
issues with a checkbox on the list but I don't know enough to know if
it has something to do with my problem. I've been pulling out my hair
for a few hours maybe someone can help me save what hair I have left.
With debug on in the dataobject options array I can see that the
variable in question (visible) has been fetched:
fetchrow LINE: visible = 1
and processing form data shows
FormBuilder: Field visible
FormBuilder: is substituted with "1"
But the update query does not include the variable, thus it is not
written to the database, while all the other fields are.
If it matters, I've extended formbuilder and created my own driver and
over ridden the getform method because it was the only way I could
figure out how to make some fields not appear (using
$form->removeElement('element').
Here is some of my code:
$formBuilder =& DB_DataObject_FormBuilder::create($do_page,false,
'MyFormBuilder');
$formBuilder->fieldAttributes = array(
'name' => array( 'cols' => '30','rows'
=> '1' ),
'description' => array( 'cols' =>
'70','rows' => '1' ),
'meta_title' => array( 'cols' =>
'70','rows' => '1' ),
'meta_description' => array( 'cols' =>
'70','rows' => '4' ),
'meta_keywords' => array( 'cols' =>
'70','rows' => '4' ),
'body_headline' => array( 'cols' =>
'70','rows' => '2' ),
'visible' => array('size' => '2'),
'body' => array( 'cols' => '70','rows'
=> '20' )
From mysql here is the description of the field:
| Field | Type | Null | Key | Default | Extra |
--------------------------------------------------------------------
visible | tinyint(1) | YES | | NULL | |
And from dataobject:
public $visible; // int(1)
I am sure I missing something like adding one of the pre or post
functions. But I haven't had any luck.
Can anyone point me in the right direction?
Thanks
Roland