HTML_QuickForm Renderer Question
| From: | Jared Allen | Date: | Tue, 21 Mar 2006 05:38:11 +0000 |
| Subject: | HTML_QuickForm Renderer Question | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-23360@lists.php.net to get a copy of this message | ||
Hello
I'm trying to use the Array renderer for HTML_QuickForm. Everything is going
fine but I can't get the validation errors to show up.
I use this code to instantiate the render with my JoinForm object that
extends quickform:
$form = new JoinForm();
// instantiate the renderer
$renderer =& new HTML_QuickForm_Renderer_Array();
// process the form
$form->accept($renderer);
// output the results
$form_a = $renderer->toArray();
The form has a number of elements like first name, last name, email address
etc. and I reference the elements from the array using this code:
<?php echo $form_a['elements'][0]['html']; ?> <?php echo
$form_a['elements'][0]['error']; ?>
<label for="<?php echo $form_a['elements'][1]['name'];
?>"><?php echo
$form_a['elements'][1]['label']; ?></label>
<?php echo $form_a['elements'][1]['html']; ?> <?php echo
$form_a['errors'][1]; ?>
For some reason the errors won't show up when javascript is disabled and the
form is submitted. And the form renders fine using the default renderer.
Is there something I'm missing?
Thanks
Jared