Chico UI

ch.Condition (Class)

Documentation updated on Fri May 18 2012 12:47:08 GMT-0300 (GMT-03:00), generated by JsDoc Toolkit 2.4.0

Overview

Description

Summary

Visibility Name Description
<private>  
Flag that let you know if the condition is enabled or not.
<public>  
Message defined for this condition
<public>  
Flag that let you know if the all conditions are enabled or not.
<protected>  
Reference to a internal component instance, saves all the information and configuration properties.
Visibility Name Description
<public>  
Turn off condition.
<public>  
Turn on condition.
<public>  
test()
Run configured condition

Classdetail

Parameters

  • condition: Object. Object with configuration properties.
  • condition.name: String.
  • condition.patt: Object, Optional.
  • condition.expr: Function, Optional.
  • condition.func: Function, Optional.
  • condition.value: Number || String, Optional.
  • condition.message: String. Validation message

Returns

  • itself

Examples

// Create a new condition object with patt.
var me = ch.condition({
    "name": "string",
    "patt": /^([a-zA-Z\u00C0-\u00C4\u00C8-\u00CF\u00D2-\u00D6\u00D9-\u00DC\u00E0-\u00E4\u00E8-\u00EF\u00F2-\u00F6\u00E9-\u00FC\u00C7\u00E7\s]*)$/,
    "message": "Some message here!"
});
// Create a new condition object with expr.
var me = ch.condition({
    "name": "maxLength",
    "patt": function(a,b) { return a.length <= b },
    "message": "Some message here!",
    "value": 4
});
// Create a new condition object with func.
var me = ch.condition({
    "name": "custom",
    "patt": function (value) { 
        if (value === "ChicoUI") {

            // Some code here!

            return true;
        };

        return false;
    },
    "message": "Your message here!"
});

Properties detail

enabled (private, boolean)

Flag that let you know if the condition is enabled or not.

message (public, string)

Message defined for this condition

name (public, string)

Flag that let you know if the all conditions are enabled or not.

that (protected, itself)

Reference to a internal component instance, saves all the information and configuration properties.

Methods detail

disable (public)

Turn off condition.

Returns
  • itself

enable (public)

Turn on condition.

Returns
  • itself

test (public)

Run configured condition

Returns
  • boolean