Home » HTML » HTML_QuickForm_Renderer_Tableless » Bug #8222
Missing <fieldset>
Details
| Submitted | 2006-07-15 00:37 UTC |
|---|---|
| From | danielmaglione at gmail dot com |
| Assigned | wiesemann |
| Status | Closed |
| Package | HTML_QuickForm_Renderer_Tableless |
| PHP Version | 5.1.4 |
| OS | Debian Sarge |
| Roadmaps | (Not assigned) |
Comments
[2006-07-15 00:37 UTC] danielmaglione at gmail dot com
Description:
------------
When I create new instance of QuickForm, setting $trackSubmit=true (I need this because I have four forms into a single PHP file), the Tableless renderer misses the <fieldset> open tag, generating an invalid XHTML, like below:
<form action="test.php" method="post" id="form">
<input name="_qf__form" type="hidden" value="" />
</fieldset>
(...)
This needs to be corrected including the open tag (if remove fieldset tag the XHTML doesn't be compliance with XHTML 1.1 specification *), but with fieldset an empty frame will be draw, that it is not desired. My sugestion is to use the inline CSS style "visibility:hidden", like example below:
<form action="test.php" method="post" id="form">
<fieldset style="visibility:hidden">
<input name="_qf__form" type="hidden" value="" />
</fieldset>
(...)
Thanks for your attention.
* document type does not allow element "input" here; missing one of "ins", "del", "h1", "h2", "h3", "h4", "h5", "h6", "p", "div", "address", "fieldset" start-tag. (by www.w3c.org).
Test script:
---------------
$form = new HTML_QuickForm('form', 'post', 'test.php', null, null, true);
$form->addElement('text', 'test', 'Test:');
$renderer =& new HTML_QuickForm_Renderer_Tableless();
$form->accept($renderer);
echo $renderer->toHtml();
Expected result:
----------------
<form action="test.php" method="post" id="form">
<fieldset style="visibility:hidden">
<input name="_qf__form" type="hidden" value="" />
</fieldset>
(...)
Actual result:
--------------
<form action="test.php" method="post" id="form">
<input name="_qf__form" type="hidden" value="" />
</fieldset>
(...)
[2006-07-18 10:51 UTC] danielmaglione at gmail dot com
Dear Mark,
First, congratulations for this excelent package and thanks for your attention.
1. Sorry, my program is biggest, and the error really don't occur with this "small" example that I send. I do more tests and this can reproduce the bug:
$form1 = new HTML_QuickForm('form1', 'post', 'test.php', null, null, true);
$form1->removeAttribute('name');
$form1->addElement('header', null, 'Test');
$form1->addElement('text', 'Test1', 'Test: ');
$form2 = new HTML_QuickForm('form2', 'post', 'test.php', null, null, true);
$form2->removeAttribute('name');
$form2->addElement('header', null, 'Test');
$form2->addElement('text', 'Test2', 'Test: ');
$form3 = new HTML_QuickForm('form3', 'post', 'test.php', null, null, true);
$form3->removeAttribute('name');
$form3->addElement('header', null, 'Test');
$form3->addElement('text', 'Test3', 'Test: ');
$renderer =& new HTML_QuickForm_Renderer_Tableless();
$form1->accept($renderer);
echo ($renderer->toHtml());
$form2->accept($renderer);
echo ($renderer->toHtml());
$form3->accept($renderer);
echo ($renderer->toHtml());
If helps, I noticed that the error only occurs when:
1. There are 2 or more forms (note in the example above that the error only occur with "form2" and "form3");
2. The error don't occur when I removed the lines $formX->addElement('header', null, 'Test');
2. I consider the W3C validator as reference. If you paste the html below, generated (and corrected) by script above, you will see the "container" requirement. I don't check the DTD my self, but if validator says...
Test
Test
Test:
Test
Test:
Test
Test:
<br />
</fieldset>
</form>
</body>
</html>
Regards,
Daniel Maglione