inputEx Documentation Back to homepage

### inputEx Documentation > inputEx.Field 0.2.2

## Static Class inputEx.Field

An abstract class that contains the shared features for all fields

Known Subclasses:
  inputEx.HiddenField inputEx.MapField inputEx.VectorField inputEx.ListField inputEx.CheckBox inputEx.Textarea inputEx.InPlaceEdit inputEx.StringField inputEx.SelectField inputEx.UneditableField inputEx.CombineField inputEx.PairField inputEx.ColorField2 inputEx.SliderField inputEx.RadioField inputEx.ColorField inputEx.Group inputEx.TypeField inputEx.ImagemapField inputEx.RTEField inputEx.MenuField inputEx.FileField

### Constructor

inputEx.Field `( options )`

Parameters:
  `options <Object>` - Configuration object
  - name: the name of the field
  - required: boolean, the field cannot be null if true
  - className: CSS class name for the div wrapper (default 'inputEx-Field')
  - value: initial value
  - parentEl: HTMLElement or String id, append the field to this DOM element

### Properties

#### static groupOptions `- Object`

group Options for each field

#### options `- Object`

Configuration object to set the options for this class and the parent classes. See constructor details for options added by this class.

### Methods

#### clear

`clear([sendUpdatedEvt])`
Clear the field by setting the field value to this.options.value
Parameters:

`sendUpdatedEvt <boolean>` optional - (optional) Wether this clear should fire the updatedEvt or not (default is true, pass false to NOT send the event)

#### close

`close()`
Close the field and eventually opened popups...

#### destroy

`destroy()`
Purge all event listeners and remove the component from the dom

#### disable

`disable()`
Disable the field

#### displayMessage

`displayMessage(msg)`
Update the message
Parameters:

`msg <String>` - Message to display

#### enable

`enable()`
Enable the field

#### fireUpdatedEvt

`fireUpdatedEvt()`
Fire the "updated" event (only if the field validated) Escape the stack using a setTimeout

#### focus

`focus()`
Focus the field

#### getEl

`<HTMLElement> getEl()`
The default render creates a div to put in the messages
Returns:

`<HTMLElement>` divEl The main DIV wrapper

#### getState

`<String> getState()`
Returns the current state (given its value)
Returns:

`<String>` One of the following states: 'empty', 'required', 'valid' or 'invalid'

#### getStateString

`getStateString(state)`
Get the string for the given state
Parameters:

`state`

#### getValue

`<Any> getValue()`
Return the value of the input
Returns:

`<Any>` value of the field

#### hide

`hide()`
Hide the field

#### initEvents

`initEvents()`
Initialize events of the Input

#### isEmpty

`isEmpty()`
Should return true if empty

#### onBlur

`onBlur(e)`
Function called on the blur event
Parameters:

`e <Event>` - The original 'blur' event

#### onChange

`onChange(e)`
onChange event handler
Parameters:

`e <Event>` - The original 'change' event

#### onFocus

`onFocus(e)`
Function called on the focus event
Parameters:

`e <Event>` - The original 'focus' event

#### render

`render()`
Default render of the dom element. Create a divEl that wraps the field.

#### renderComponent

`renderComponent()`
Render the interface component into this.divEl

#### setClassFromState

`setClassFromState()`
Set the styles for valid/invalide state

#### setOptions

`setOptions(options)`
Set the default values of the options
Parameters:

`options <Object>` - Options object (inputEx inputParams) as passed to the constructor

#### setValue

`setValue(value[,sendUpdatedEvt])`
Function to set the value
Parameters:

`value <Any>` - The new value

`sendUpdatedEvt <boolean>` optional - (optional) Wether this setValue should fire the updatedEvt or not (default is true, pass false to NOT send the event)

#### show

`show()`
Show the field

#### updatedEvt

`updatedEvt(value)`
YAHOO custom event fired when the field is "updated"
subscribe with: this.updatedEvt.subscribe(function(e, params) { var value = params[0]; console.log("updated",value, this.updatedEvt); }, this, true);
Parameters:

`value <Any>` - The new value of the field

#### validate

`<Boolean> validate()`
Validation of the field
Returns:

`<Boolean>` field validation status (true/false)

Copyright (c) 2007-2009 Eric Abouaf. All rights reserved.
Generated by JsDoc Toolkit 2.0.0 on Wed, 04 Mar 2009 15:41:31 GMT using neyricjslibs-template.