Re: Formbuilder refuses to save checkbox value

From: Date: Mon, 02 Jan 2006 22:47:58 +0000
Subject: Re: Formbuilder refuses to save checkbox value
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22409@lists.php.net to get a copy of this message
On 1/2/06, roland cruse <crusester@gmail.com> wrote: > 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'). > And overridden getForm? There are not many reasons to override this. It kills most of what FormBuilder can do for you... If you need to remove fields, use the fieldsToRender option to tell FormBuilder what fields to display. http://opensource.21st.de/23.html#A46 > 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 > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Justin Patrin

« previous php.pear.general (#22409) next »