Closed (won't fix)
Project:
Content Construction Kit (CCK)
Version:
4.7.x-1.x-dev
Component:
General
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
31 Oct 2006 at 15:33 UTC
Updated:
23 Jul 2008 at 21:20 UTC
Jump to comment: Most recent file
Comments
Comment #1
fortytwo commentedand the (quite empty :-) install
Comment #2
mki commentedThank you fortytwo very much. This is very useful and needed long ago. I think many people just using integer or text types istead of boolean taking as allowed values text true/false or digits 0/1. But boolean field is much esier to create, validate and using less resource of database.
Can you only improve this module to taking empty value as well as true and false? This is needed when field isn't requiered, becouse if checkbox is empty it mean false, if it is select it mean true and there no posible to set empty value, so user like it or not must choose true or false. Maybe we should use widget other than checkbox.
Comment #3
mki commentedI tried to provide some code to improve this module but I still don't know Drupal enough. Maybe Select/Textbox/Radio Field issue can help you fortytwo becouse it have much in common, but you must carefully read comments, especially when JonBob express differentiate between fields and widgets.
Comment #4
fortytwo commentedActually I was planning to make a very simple, easy to use boolean field for stuff like "read license/didnt read license", "smoker/no smoker" etc. So a checkbox is the ideal solution for that.
If you want more (more states than true/false or other waya of displaying), you should stick to a normal integer field.
Comment #5
mki commentedOK fortytwo, I will try produce some code. If someone want help my please wait till I share it here.
Comment #6
mki commentedPlease carefully review this code becouse I'm newbie. I think there are some bugs and not the best solutions because of existing modules or performacne. I'd like to get this issue commited, so please help me if you can.
My principles:
Comment #7
mki commentedATTENTION: I developed this code when Improved handling for optionwidgets is commited in its current stage.
Comment #8
mki commentedRevision of principle 2:
If NULL values issue will be accepted (probably will be) and becouse of things maked a move (see: Content module will not store NULL values and Default values for fields) I think for better performance of database we should use tinyint(1) (boolean, bool) instead of varchar(1). If above-mentioned issue will get through, we will use NULL/0/1 values of this field. This is very important to creating this module, that database storage way bring real benefit in comparison with text or integer modules. In addition we want easier creating and validating Yes/No fields, and maybe using this module instead of others bring more benefit in Views etc.
Comment #9
mki commentedAttachment with some changes.
For boolean fields PostgreSQL use "boolean", MySQL use "tinyint(1)" witch have aliases "bool" and "boolean". Becouse in content_admin.inc we have:
i decide to use "boolean" becouse if I use "tinyint(1)" it will be mean that we don't utilize PostgreSQL type "boolean" witch may be more efficient for this database.
To use this module with optionwidgets.module we need to add "boolean" type like below:
Comment #10
mki commentedI'm not sure that my module is really needed. Please help my take a decision about developing this module.
Here are benefits that I can see:
Weak points:
Comment #11
dopry commentedthis can be done with textfield in 5.x, and 6.x. It will not be added to 4.7.x-1.x.