DOFB how to register custom element
| From: | Alexander Petri | Date: | Tue, 25 Jan 2005 18:12:02 +0000 |
| Subject: | DOFB how to register custom element | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-17151@lists.php.net to get a copy of this message | ||
i want to use a custom element for my application
hardcoded, my form looks like this:
$form = new HTML_QuickForm();
$form->registerElementType('htmlarea', 'HTML/QuickForm/htmlarea.php',
'HTML_QuickForm_htmlarea');
$options = array('url' => '../js/htmlarea/');
$attributes = array('rows' => 25, 'cols' => 80);
$config = array('width' => '300px', 'height' =>
'300px','statusBar'=>true,'pageStyle'=>'@import
url(../css/style.css);');
$options2 = $options;
$options2['config'] = $config;
$form->addElement('htmlarea', 'text2', 'HTMLArea2', $options2,
$attributes);
$form->addElement('submit', '__submit__', 'Testing');
$htmlarea2 = &$form->getElement('text2');
$htmlarea2->registerPlugin('ContextMenu');
$htmlarea2->registerPlugin('TableOperations');
$htmlarea2->registerPlugin('DynamicCSS');
$htmlarea2->setToolbar(array('fontname',
'fontsize','DynamicCSS-class',
'linebreak',
'bold', 'italic', 'underline','separator',
"justifyleft", "justifycenter", "justifyright",
"justifyfull",'separator',
"outdent", "indent", "separator",
"createlink",'htmlmode'));
print $form->toHtml();
but how can i include this in my DO?
function preGenerateForm(&$fb) {
$this->fb_preDefElements['news_text'] =
HTML_QuickForm::createElement('textarea',
'news_text','Newstext',array("cols"=>"45","rows"=>"8"));
should be
$this->fb_preDefElements['news_text'] =
HTML_QuickForm::createElement('htmlarea', ....));
could someone help me?