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

Bug #6134 advcheckbox data not posted when ID is set on element
Submitted: 2005-12-03 02:51 UTC
From: phunkymunky at gmail dot com Assigned: avb
Status: Closed Package: HTML_QuickForm
PHP Version: 5.1.0 OS: FC4
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 : 36 - 18 = ?

 
 [2005-12-03 02:51 UTC] phunkymunky at gmail dot com
Description: ------------ Setting the ID of an advcheckbox element causes the element data not to be posted. This is caused as the hidden element is not updated properly. To get around the problem, the ID can be prefixed by '__': this causes the hidden element to be updated properly. This test script shows a small quickform followed by a var dump of the posted data. When both boxes are clicked, a value of 1 is expected to be seen underneath in the posted data for both values. The first checkbox data is never set as the id is set to the name of the element. When the id is set to the name of the hidden element, as per the second checkbox, the data is returned properly. Suggest prefixing the element ID with '__' when it is passed to createElement() as an attribute to fix this problem :) Test script: --------------- <?php require_once 'HTML/QuickForm.php'; $form = new HTML_QuickForm('form', 'post'); $form->addElement('advcheckbox', 'willfail', 'ID Set normally (id=willfail)', null, 'id=willfail'); $form->addElement('advcheckbox', 'willwork', 'ID Set with workaround (id=_willwork)', null, 'id=__willwork'); $form->addElement('submit', 'submit', 'Submit'); $form->display(); echo '<pre>'; echo var_dump($form->exportValues()); echo '</pre>'; ?> Expected result: ---------------- Expected result should show '1' for both fields array(3) { ["willfail"]=> string(0) "1" ["willwork"]=> string(1) "1" ["submit"]=> string(6) "Submit" } Actual result: -------------- Actual result only shows 1 for field with ID workaround array(3) { ["willfail"]=> string(0) "" ["willwork"]=> string(1) "1" ["submit"]=> string(6) "Submit" }

Comments

 [2006-06-03 15:11 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-06-20 16:46 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!