ch.Validation (Class)
Documentation updated on Fri Mar 09 2012 15:11:04 GMT-0300 (GMT-03:00), generated by JsDoc Toolkit 2.4.0
Overview
Validation is a validation engine for html forms elements.
- Constructor name: ch.Validation(conf)
- ch.Validation extends ch.Controls.
- View source on GitHub.
Summary
| Visibility | Name | Description |
|---|---|---|
| <public> |
Reference to a DOM Element.
|
|
| <protected> |
Flag that let you know if the validations is enabled or not.
|
|
| <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> |
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,position,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()
|
Clear all active validations.
|
| <public> |
disable()
|
Turn off Validation and Validator engine or an specific condition.
|
| <public> |
enable()
|
Turn on Validation and Validator engine or an specific condition.
|
| <public> |
hasError()
|
Run all configured validations.
|
| <public> |
isActive()
|
Turn off Validation and Validator engine or an specific condition.
|
| <public> |
validate()
|
Run all configured validations.
|
| <private> |
value()
|
Returns a value of element
|
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.
Returns
- itself
Requires
See
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.
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
validate (public)
Run all configured validations.
Returns
- boolean
value (private)
Returns a value of element
Returns
- string
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();
});