Chico UI

ch.Validation (Class)

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

Overview

Validation is a validation engine for html forms elements.

Summary

Visibility Name Description
<public>  
Reference to a DOM Element.
<protected>  
Flag that let you know if the validations is enabled or not.
<protected>  
Stores the error object
<protected>  
Reference to the Float component instanced.
<public>  
Is the little sign that floats showing the validation message.
<public>  
Is the little sign that floats showing the validation message.
<protected>  
Runs all validations to check if it has an error.
<public>  
Deprecated: Used by the helper's positioner to do his magic.
<protected>  
Reference to a internal component instance, saves all the information and configuration properties.
<public>  
This public property defines the component type.
<public>  
uid
The 'uid' is the Chico's unique instance identifier.
<private>  
Validation event
<public>  
Is the little sign that floats showing the validation message.

Fields borrowed from class ch.Controls: createFloat

Fields borrowed from class ch.Uiobject: DOMParent,originalContent,staticContent

Visibility Name Description
<public>  
and()
Let you keep chaining methods.
<private>  
Search for instances of Validation with the same trigger, and then merge it's properties with it.
<public>  
Clear all active validations.
<public>  
Turn off Validation and Validator engine or an specific condition.
<public>  
Turn on Validation and Validator engine or an specific condition.
<public>  
Run all configured validations.
<public>  
Turn off Validation and Validator engine or an specific condition.
<public>  
Sets or gets conditions messages
<public>  
Sets or gets positioning configuration.
<public>  
Turn on/off the Validation and Validator engine.
<public>  
Run all configured validations.

Methods borrowed from class ch.Uiobject: content, prevent

Methods borrowed from class ch.Object: callbacks, off, on, once, trigger

Visibility Name Description
<public>  
Triggers when the validation process ends.
<public>  
Triggers before start validation process.
<public>  
Triggers when al validations are cleared.
<public>  
Triggers when an error occurs on the validation process.
<public>  
Triggers when the component is ready to use.

Classdetail

Parameters

  • conf: Object, Optional. Object with configuration properties.
  • conf.message: String, Optional. Validation message.
  • conf.points: String, Optional. Sets the points where validation-bubble will be positioned.
  • conf.offset: String, Optional. Sets the offset in pixels that validation-bubble will be displaced from original position determined by points. It's specified by configuration or zero by default: "0 0".
  • conf.context: String, Optional. It's a reference to position the validation-bubble.

Returns

  • itself

Requires

Properties detail

element (public, HTMLElement)

Reference to a DOM Element. This binding between the component and the HTMLElement, defines context where the component will be executed. Also is usual that this element triggers the component default behavior.

enabled (protected, boolean)

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

error (protected, Object)

Stores the error object

float (protected, Object)

Reference to the Float component instanced.

form (public, ch.Form)

Is the little sign that floats showing the validation message. Is a Float component, so you can change it's content, width or height and change its visibility state.

See

helper (public, ch.Helper)

Is the little sign that floats showing the validation message. Is a Float component, so you can change it's content, width or height and change its visibility state.

See

process (protected, function)

Runs all validations to check if it has an error.

Returns
  • boolean

reference (public, jQuery Object)

Deprecated: Used by the helper's positioner to do his magic.

that (protected, itself)

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

type (public, string)

This public property defines the component type. All instances are saved into a 'map', grouped by its type. You can reach for any or all of the components from a specific type with 'ch.instances'.

uid (public, number)

The 'uid' is the Chico's unique instance identifier. Every instance has a different 'uid' property. You can see its value by reading the 'uid' property on any public instance.

validationEvent (private)

Validation event

validator (public, ch.Validator)

Is the little sign that floats showing the validation message. Is a Float component, so you can change it's content, width or height and change its visibility state.

See

Methods detail

and (public)

Let you keep chaining methods.

Returns
  • jQuery Object

checkInstance (private)

Search for instances of Validation with the same trigger, and then merge it's properties with it.

Returns
  • Object

clear (public)

Clear all active validations.

Returns
  • itself

disable (public)

Turn off Validation and Validator engine or an specific condition.

Returns
  • itself
See

enable (public)

Turn on Validation and Validator engine or an specific condition.

Returns
  • itself
See

hasError (public)

Run all configured validations.

Returns
  • boolean

isActive (public)

Turn off Validation and Validator engine or an specific condition.

Returns
  • boolean
See

message (public)

Sets or gets conditions messages

Examples
validation.message(condition, message);
// Sets a new message
validation.message("required", "New message for required validation");
// Gets a message from a condition
validation.message("required");
Returns
  • itself

position (public)

Sets or gets positioning configuration. Use it without arguments to get actual configuration. Pass an argument to define a new positioning configuration.

Examples
// Change validaton bubble's position.
validation.position({
	  offset: "0 10",
	  points: "lt lb"
});
Returns
  • itself
See

toggleEnable (public)

Turn on/off the Validation and Validator engine.

Returns
  • itself
See

validate (public)

Run all configured validations.

Returns
  • boolean

Events detail

afterValidate (public)

Triggers when the validation process ends.

Examples
me.on("afterValidate",function(){
	submitButton.disable();
});

beforeValidate (public)

Triggers before start validation process.

Examples
me.on("beforeValidate",function(event) {
	submitButton.disable();
});

clear (public)

Triggers when al validations are cleared.

Examples
me.on("clear",function(){
	submitButton.enable();
});

error (public)

Triggers when an error occurs on the validation process.

Examples
me.on("error",function(event, condition) {
	if (condition === "required") {
		errorModal.show();
	}
});

ready (public)

Triggers when the component is ready to use.

Examples
// Following the first example, using 'me' as modal's instance controller:
me.on("ready",function(){
	this.show();
});