Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.6.2

Bug #8222 Missing <fieldset>
Submitted: 2006-07-15 00:37 UTC
From: danielmaglione at gmail dot com Assigned: wiesemann
Status: Closed Package: HTML_QuickForm_Renderer_Tableless (version 0.3.0)
PHP Version: 5.1.4 OS: Debian Sarge
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 31 - 12 = ?

 
 [2006-07-15 00:37 UTC] danielmaglione at gmail dot com (Daniel Maglione)
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> (...)

Comments

 [2006-07-16 19:45 UTC] wiesemann (Mark Wiesemann)
Hi Daniel, thanks for your report. But: 1. Your test script does not show the behaviour you describe. I can confirm an issue with addStopFieldsetElements() that outputs the closing </fieldset> even if no <fieldset> tag was outputted. I'll fix that. Is this the problem that you wanted to describe? If not, please give me a proper test script. 2. I can't find a word about a *required* fielset tag in the XHTML specification. If this requirement really exists, please give a link where this is stated. Regards, Mark
 [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
<br /> </fieldset> </form> </body> </html> Regards, Daniel Maglione
 [2006-07-18 12:41 UTC] wiesemann (Mark Wiesemann)
Okay, about the multiple forms problem: The problem was that the status variable that indicated whether a fieldset tag was open or not, wasn't resetted between different forms. That's fixed in CVS now and your (new) test script produces the expected XHTML code. About the XHTML validity: You're right, the validator and also a short look into the DTD say this. I'll try to find a solution for this. It is not as easy as using <fieldset style="visibility: hidden"> because not only <input type="hidden"> elements may occur outside a fiedset, but also visible ones (e.g. text fields or buttons as in my DHTMLRulesTableless example).
 [2006-07-18 14:28 UTC] wiesemann (Mark Wiesemann)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. --- A new release is on the way, including all needed changes. See the changelog for a full list of the changes.