Re: Form_Builder: how do you add a 'static' QuickForm element?

From: Date: Fri, 07 Jan 2005 10:00:26 +0000
Subject: Re: Form_Builder: how do you add a 'static' QuickForm element?
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16777@lists.php.net to get a copy of this message
l Burnerheimerton wrote:
I can't get it to work in preDefElements because it's not one. Whatever the code format, I assume should work for header, hidden elements not in your database fields list, html, image, or anything that is not in the predefined list of fields DataObject generated.
Additionally to your preDefElement you need a virtual field. The concept of virtual fields is described here: http://opensource.21st.de/tiki-index.php?page=Beyond+Advanced#id323241 A hidden virtual field: function table() {
     $virtualfields = array();
     $virtualfields['test'] = DB_DATAOBJECT_STR;
     return array_merge(parent::table(), $virtualfields);
} function preGenerateForm($fb) {
     $this->fb_preDefElements = array();
     $hidden =& HTML_QuickForm::createElement('hidden', 'test');
     $this->fb_preDefElements['test'] = &$hidden;
     $this->test = '123';
} If you use $fb_fieldsToRender and/or $fb_preDefOrder don't forget to put your hidden field in there too. Arne

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