Overview
inputEx is built around the Field class. It is an abstract class (we never instantiate it).
All the other field classes inherits directly or indirectly from this base class. (see diagram below)
Instantiating a Field / the "type" property :
There are 4 ways to instanciate a Field :
- Calling the class constructor (classic) :
- Using the inputEx.buildField function with the "type" construction:
- Using the inputEx.buildField function with the "fieldClass" construction:
- Through a meta-field (see below)
The default "type" associations :
| boolean | inputEx.CheckBox |
| color | inputEx.ColorField |
| date | inputEx.DateField |
| email | inputEx.EmailField |
| form | inputEx.Form |
| group | inputEx.Group |
| hidden | inputEx.HiddenField |
| html | inputEx.RTEField |
| inplaceedit | inputEx.InPlaceEdit |
| IPv4 | inputEx.IPv4Field |
| list | inputEx.ListField |
| pair | inputEx.PairField |
| password | inputEx.PasswordField |
| select | inputEx.SelectField |
| string | inputEx.StringField |
| text | inputEx.Textarea |
| type | inputEx.TypeField |
| uneditable | inputEx.UneditableField |
| url | inputEx.UrlField |
To link a class with a "type", we use :
Meta-Fields :
Some special fields called meta-fields take one or multiple "type" construction objects as configuration.
- Group: A group of fields. It is itself a Field so it can be combined with any other field.
- Form: A group that provide ajax form capabilities.
- List: list of any subfield.
- InPlaceEdit: Make any subfield inplace-editable.
- Typefield: A special field that returns a config object to create an instance through the inputEx.buildField function. We create a form for each Field class to define the parameters for the specified field.
Insert a Field into the DOM :
The "updated" event :
All the fields fire the same event when they are "updated".
To subscribe this event for a field, use : (see YUI Custom Events for more informations)