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

Request #18683 $id with blanks not handled correctly
Submitted: 2011-07-25 10:10 UTC
From: eryjus Assigned: avb
Status: Closed Package: HTML_QuickForm2 (version 0.6.0)
PHP Version: 5.3.6 OS: Fedora Core 14
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 : 41 - 36 = ?

 
 [2011-07-25 10:10 UTC] eryjus (Adam Clark)
Description: ------------ From the QuickForm2 Tutorial, changed the $id of the form form 'tutorial' to 'test form'. The constructor did not recognize that the form was submitted. Removed the space and the form works as expected. Test script: --------------- $form = new HTML_QuickForm2('test form'); $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array( 'name' => 'Joe User' ))); $fieldset = $form->addElement('fieldset')->setLabel('QuickForm2 tutorial example'); $name = $fieldset->addElement('text', 'name', array('size' => 50, 'maxlength' => 255)) ->setLabel('Enter your name:'); $submit = $fieldset->addElement('submit', null, array('value' => 'Send!')); if ($form->validate()) { echo '<h1>Hello, ' . htmlspecialchars($name->getValue()) . '!</h1>'; exit; } echo $form; Expected result: ---------------- After changing the name to 'World', I expect to see, "Hello, World!". Actual result: -------------- The form is displayed as if it was loaded for the first time, even with all the defaults from the code.

Comments

 [2011-07-25 16:21 UTC] avb (Alexey Borzov)
-Status: Open +Status: Bogus
Spaces are not allowed in elements' id attributes. You can complain to authors of HTML specification if you don't like this fact.
 [2011-07-26 07:38 UTC] eryjus (Adam Clark)
Alexey, Thank you and understood. With that said, wouldn't it be prudent for the constructor to throw an exception when an invalid argument is passed to it (such as the illegal space)?
 [2011-08-04 15:04 UTC] avb (Alexey Borzov)
-Status: Bogus +Status: Assigned -Type: Bug +Type: Feature/Change Request -Assigned To: +Assigned To: avb
It may indeed make sense to throw an exception for incorrect id in setId() method. It may also make sense to route setting the form's id through that method instead of doing it in the constuctor.
 [2011-09-28 19:37 UTC] avb (Alexey Borzov)
-Status: Assigned +Status: Closed
This bug has been fixed in SVN. 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.