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

Request #3288 New Boolean issue.
Submitted: 2005-01-25 00:58 UTC
From: rolf at winmutt dot com Assigned:
Status: Open Package: DB_DataObject_FormBuilder
PHP Version: 5.0.3 OS: ANY
Roadmaps: (Not assigned)    
Subscription  
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
2005-03-31 00:48 UTC
Package:
Bug Type:
Summary:
From: rolf at winmutt dot com
New email:
PHP Version: Package Version: OS:

 

 [2005-01-25 00:58 UTC] rolf at winmutt dot com
Description: ------------ Spoke with Justin about this : Re : Boolean I'll issue this as a bug if needed, if a bool is NOT NULL then only a selected status of the checkbox will pass validation. In reality, NULLable booleans should be yes/no radio button and NOT NULL should be a checkbox but not required. If neither Yes/No (T/F whatever) is not set then it is NULL. I use this for an "active" (BOOLEAN NOT NULL DEFAULT TRUE) field in most of my tables to preserve old records instead of deleting them.

Comments

 [2005-01-25 01:06 UTC] alan_k
Care to elaborate on this: What is the column definition you have, What does DataObjects generate as it's type What should DataObjects generate as it's type Regards Alan
 [2005-01-25 02:08 UTC] rolf at winmutt dot com
sry this is FormBuilder issues
 [2005-01-27 02:52 UTC] justinpatrin
I finally got back to this one and I'm still not sure what I want to do about it. It makes a little sense to me to make radio buttons for a boolean which can be null as no selection equates to null, but there are two problems. First, what are the radio button labels? yes/no? true/false? Second, and more important, how do you go *back* to null. AFAIK there's no way to de-select radio buttons.
 [2005-01-28 01:26 UTC] rolf at winmutt dot com
Yes No None radios buttons perhaps? SOME browsers let you uncheck a button after its checked. It is not a perfect fix, but the current setup is incorrect. What happens if its NOT NULL and the customer leaves it unchecked? The checkbox does not end up in _REQUEST, leaving the field NULL. I guess one way to fix this would be to leave the field as not null and interpret null or false as false.
 [2005-01-28 01:34 UTC] rolf at winmutt dot com
Perhaps advcheckbox would be a better start over the normal checkbox? 'advcheckbox' Class for an advanced checkbox type field, HTML_QuickForm_advcheckbox. Basically this fixes a problem that HTML has had where checkboxes can only pass a single value (the value of the checkbox when checked).
 [2005-01-28 01:36 UTC] justinpatrin
No, you're assuming too much. If you check the code in processForm, it makes sure that all boolean fields have a value. If there is nothing in the passed in array ($_REQUEST), then it sets the boolean to 0. foreach ($this->booleanFields as $boolField) { if (!isset($values[$boolField])) { $this->_do->$boolField = 0; } } foreach ($tableFields as $field => $type) { if ($type & DB_DATAOBJECT_BOOL && !isset($values[$field])) { $this->_do->$field = 0; } } Yes/No/None *might* be ok, but this is still not necessarily correct...what if you want True,False,N/A? I suppose we can make a config option for this...... Anyone else have comments on how NULLable boolean fields should work?
 [2005-03-31 00:48 UTC] justinpatrin
Reclassifying as a Feature/Change Request as FormBuilder really doesn't handle NULL values in any way shape or form. This needs to be though through more.