ch.Form (Class)
Documentation updated on Mon Mar 12 2012 17:48:11 GMT-0300 (GMT-03:00), generated by JsDoc Toolkit 2.4.0
Overview
Forms is a Controller of DOM's HTMLFormElement.
- Constructor name: ch.Form(conf)
- ch.Form extends ch.Controllers.
- View source on GitHub.
Summary
| Visibility | Name | Description |
|---|---|---|
| <public> |
Watcher instances associated to this controller.
|
|
| <public> |
The element reference.
|
|
| <public> |
Collection of messages defined.
|
|
| <private> |
A Boolean property that indicates is exists errors in the form.
|
|
| <private> |
Reference to a internal component instance, saves all the information and configuration properties.
|
|
| <public> |
The component's type.
|
|
| <public> |
The component's instance unique identifier.
|
Fields borrowed from class ch.Uiobject: DOMParent,originalContent,position,staticContent
| Visibility | Name | Description |
|---|---|---|
| <public> |
clear()
|
Use this method to clear al validations.
|
| <public> |
Return the status value.
|
|
| <public> |
reset()
|
Use this method to clear al validations.
|
| <public> |
submit()
|
This methods triggers the 'beforSubmit' callback, then will execute validate() method, and if is defined triggers 'onSubmit' callback, at the end will trigger the 'afterSubmit' callback.
|
| <public> |
validate()
|
Executes all children's validations, if finds a error will trigger 'onError' callback, if no error is found will trigger 'onValidate' callback, and allways trigger 'afterValidate' callback.
|
Methods borrowed from class ch.Uiobject: content, prevent
Methods borrowed from class ch.Object: callbacks, off, on, once, trigger
| Visibility | Name | Description |
|---|---|---|
| <public> |
Callback function
|
|
| <public> |
Callback function
|
|
| <public> |
Callback function
|
|
| <public> |
Callback function
|
|
| <public> |
Callback function
|
|
| <public> |
Callback function
|
|
| <public> |
Callback function
|
|
| <public> |
Triggers when the component is ready to use (Since 0.8.0).
|
|
| <public> |
Callback function
|
|
| <public> |
Callback function
|
Classdetail
Parameters
-
conf: Object, Optional. Object with configuration properties. -
conf.messages: Object, Optional.
Returns
- itself
See
- ch.Watchers
Examples
// Create a new form with configuration.
var me = $(".example").form({
"messages": {
"required": "Error message for all required fields.",
"email": "Show this message on email format error."
}
});
// Create a new form without configuration.
var me = $(".example").form();
Properties detail
children (public, collection)
Watcher instances associated to this controller.
element (public, HTMLElement)
The element reference.
messages (public, string)
Collection of messages defined.
status (private, boolean)
A Boolean property that indicates is exists errors in the form.
that (private, object)
Reference to a internal component instance, saves all the information and configuration properties.
type (public, string)
The component's type.
uid (public, number)
The component's instance unique identifier.
Methods detail
clear (public)
Use this method to clear al validations.
Returns
- itself
getStatus (public)
Return the status value.
Returns
- itself
reset (public)
Use this method to clear al validations.
Returns
- itself
submit (public)
This methods triggers the 'beforSubmit' callback, then will execute validate() method, and if is defined triggers 'onSubmit' callback, at the end will trigger the 'afterSubmit' callback.
Returns
- itself
validate (public)
Executes all children's validations, if finds a error will trigger 'onError' callback, if no error is found will trigger 'onValidate' callback, and allways trigger 'afterValidate' callback.
Returns
- itself
Events detail
afterSubmit (public)
Callback function
afterValidate (public)
Callback function
beforeSubmit (public)
Callback function
beforeValidate (public)
Callback function
error (public)
Callback function
onClear (public)
Callback function
onReset (public)
Callback function
ready (public)
Triggers when the component is ready to use (Since 0.8.0).
Examples
// Following the first example, using 'me' as form's instance controller:
me.on("ready",function () {
this.reset();
});
submit (public)
Callback function
validate (public)
Callback function