5098 Posts in 1518 Topics by 1115 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1252 Views |
-
HasOneComplexTableField and Booleans

24 July 2009 at 1:36pm
I have a HasOneComplexTableField on a page in the CMS and one of the columns displayed is of type 'Boolean'.
It's saved in the database as either 1 or 0 and it's DISPLAYED as either 1 or 0. Which is fair enough but potentially confusing for the end users.
Is there some way that I can "decode" the 1 and 0 into something like 'Y' and 'N' or whatever?
I only want that for the display.
-
Re: HasOneComplexTableField and Booleans

24 July 2009 at 2:37pm
Perhaps create a new function (or try overloading your db field in your object). So say your boolean is "HasValue" => "Boolean" you can define something like getHasValueNice() { return ($this->HasValue) ? "Yes" : "No"; } and change your TableField to use HasValueNice rather then HasValue.
You could try overload it by creating a getHasValue() function (same as the dbfield) but not sure if you will run into other issues
-
Re: HasOneComplexTableField and Booleans

24 July 2009 at 6:51pm Last edited: 24 July 2009 7:26pm
Hey, that sounds interesting. I'll give it a go.
I can just see the end user asking what all those ones and zeros mean and I might as well preempt them.
ADDED:
Yup! Works perfectly. Sweet! Thanks!
| 1252 Views | ||
|
Page:
1
|
Go to Top |


