3.2.0

[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)
June 18,

This topic is archived.

See also:


Back to support forum