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

Bug #3167 checkbox type does not permitting setting a DB_DATAOBJECT_BOOL field to false
Submitted: 2005-01-11 20:09 UTC
From: ate2 at cornell dot edu Assigned: justinpatrin
Status: Closed Package: DB_DataObject_FormBuilder
PHP Version: Irrelevant OS: Irrelevant
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 : 6 + 12 = ?

 
 [2005-01-11 20:09 UTC] ate2 at cornell dot edu
Description: ------------ The checkbox value only registers in a form if it is checked. Consequently an unchecked checkbox won't register at all. Thus you can set a boolean from false to true but not true to false with the present automatic type of DB_DATAOBJECT_BOOL fields. Better to use the otherwise identical "advcheckbox" type which uses javascript and hidden fields to add this functionality to the basic checkbox type. This has been working well for me. One small problem (with either checkbox) would be that it could be possible to have a NULL boolean field in which case there would be a third value to consider. Maybe should generate a select element with empty option for null bool fields? Reproduce code: --------------- // Assume user has unchecked the box $do =& new DataObject(); $do->boolVal = true; $fb =& new DataObject_FormBuilder($do); $form =& $fb->getForm(); if ($do->validate()) { $fb->processForm($form->exportValues()); if ($do->boolVal) { "Value is true"; } else { "Value is false"; } } echo $form->toHtml(); Expected result: ---------------- "Value is false" Actual result: -------------- "Value is true"

Comments

 [2005-01-12 02:38 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!