:: Forum >>

[ER] - AW Boolean data format

Alex,

Someday you wrote in this forum that you would like to create a Boolean data format; here is my contribution
/****************************************************************
    AW Boolean data format.
*****************************************************************/

AW.Formats.Boolean = AW.System.Format.subclass();
AW.Formats.Boolean.create = function(){

    var obj = this.prototype;

    obj.dataToText = function(data){return '';};
    obj.dataToValue = function(data){return (data === 'true' || data === '1');};

    obj.textToValue = function(text){return (text === 'true' || text === '1');};
    obj.textToData = function(text){return text;};

    obj.valueToData = function(value){return value ? 'true' : 'false';};
    obj.valueToText = function(value){return this.dataToText(this.valueToData(value));};
};
Thierry Nivelet (FoxInCloud)
Saturday, June 18, 2011

This topic is archived.


Back to support forum

Forum search