QuickHtml renderer example shows notice

From: Date: Mon, 26 Apr 2004 10:26:03 +0000
Subject: QuickHtml renderer example shows notice
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12122@lists.php.net to get a copy of this message
hello everybody, I´m trying the basic example of quickhtml renderer, but it gives a notice I can´t get rid of. Anybody knows the reason? The example provided has something missing? Notice: Array to string conversion in c:\php\pear\pear\HTML\QuickForm\Renderer\Default.php on line 180 <? require_once 'HTML/QuickForm.php'; require_once 'HTML/QuickForm/Renderer/QuickHtml.php'; // Create form elements and renderer $form =& new HTML_QuickForm('tmp_form','POST'); $renderer =& new HTML_QuickForm_Renderer_QuickHtml(); $form->addElement('text','tmp_text',null,array('size' => 10)); // Create a hidden element. Note how we don't render it explicitly, // rather we let QuickHtml render it for us at the beginning of the form. $form->addElement('hidden','tmp_hidden'); // Create 2 radio elements. Note how we have to give a value when rendering // them since that is the only way to tell them apart. $form->addElement('radio','tmp_radio',null,null,'Y'); $form->addElement('radio','tmp_radio',null,null,'N'); // Create a group with a rule $text = array(); $text[] =& HTML_QuickForm::createElement('text','',null,array('size' => 3)); $text[] =& HTML_QuickForm::createElement('text','',null,array('size' => 4)); $text[] =& HTML_QuickForm::createElement('text','',null,array('size' => 3)); $form->addGroup($text, 'tmp_phone', null, '-'); $form->addRule('tmp_phone','Phone number cannot be empty.','required',null,'client'); // Do the magic of creating the form. NOTE: order is important here: this must // be called after creating the form elements, but before rendering them. $form->accept($renderer); // Create a very basic template for our form $html_template = ' <div style="text-align: center;">%phoneNumber%</div> <div style="text-align: left;">Yes: %radioElementYes% No: %radioElementNo%</div>'; // Interpolate the form elements into our template $html_template = str_replace('%phoneNumber%', $renderer->elementToHtml('tmp_phone'), $html_template); $html_template = str_replace('%radioElementYes%', $renderer->elementToHtml('tmp_radio', 'Y'), $html_template); $html_template = str_replace('%radioElementNo%', $renderer->elementToHtml('tmp_radio', 'N'), $html_template); // The form tags, javascript, and hidden element will be wrapped around // our html template echo $renderer->toHtml($html_template); ?>

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