ch.Countdown (Class)
Documentation updated on Fri May 18 2012 12:47:08 GMT-0300 (GMT-03:00), generated by JsDoc Toolkit 2.4.0
Overview
Counts the amount of characters that user can enter in a form control and limit the length of value of input.
- Constructor name: ch.Countdown(conf)
- ch.Countdown extends ch.Controls.
- View source on GitHub.
Summary
| Visibility | Name | Description |
|---|---|---|
| <private> |
Length of value of form control.
|
|
| <public> |
Reference to a DOM Element.
|
|
| <private> |
Amount of free characters until full the field.
|
|
| <private> |
Reference to an 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.
|
Fields borrowed from class ch.Controls: createFloat
Fields borrowed from class ch.Uiobject: DOMParent,originalContent,position,staticContent
| Visibility | Name | Description |
|---|---|---|
| <protected> |
process()
|
Process input of data on form control and updates remaining amount of characters or limits the content length
|
| <private> |
updateRemaining(num)
|
Change the visible message of remaining characters.
|
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 component is ready to use.
|
Classdetail
Parameters
-
conf: Object. Object with configuration properties. -
conf.max: Number. Number of the maximum amount of characters user can input in form control. -
conf.plural: String, Optional. Message of remaining amount of characters, when it's different to 1. The variable that represents the number to be replaced, should be a hash. By default this parameter is "# characters left.". -
conf.singular: String, Optional. Message of remaining amount of characters, when it's only 1. The variable that represents the number to be replaced, should be a hash. By default this parameter is "# character left.".
Returns
- itself
Examples
// Create a new Countdown with configuration.
var me = $(".some-form-control").countdown({
"max": 500,
"plural": "Restan # caracteres.",
"singular": "Resta # caracter."
});
// Create a simple Countdown
var me = $(".some-form-control").countdown(500);
// Now 'me' is a reference to the Countdown instance controller.
Properties detail
contentLength (private, Number)
Length of value of form control.
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.
remaining (private, Number)
Amount of free characters until full the field.
that (private, Object)
Reference to an 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.
Methods detail
process (protected)
Process input of data on form control and updates remaining amount of characters or limits the content length
updateRemaining (private)
Change the visible message of remaining characters.
Parameters
-
num: . {Number} Remaining characters.
Events detail
ready (public)
Triggers when component is ready to use.
Examples
// Following the first example, using 'me' as Countdown's instance controller:
me.on("ready",function () {
this.element;
});