# inputEx-library

### inputEx 0.5.1

inputEx-library > inputEx > inputEx.Field
Search:
Filters Show Private Show Protected Show Deprecated

## Class inputEx.Field

Known Subclasses:
  inputEx.CheckBox inputEx.ListField inputEx.Textarea inputEx.VectorField inputEx.Group inputEx.SerializeField inputEx.RadioField inputEx.MenuField inputEx.FileField inputEx.ColorPickerField inputEx.TypeField inputEx.UneditableField inputEx.ColorField inputEx.RTEField inputEx.MapField inputEx.SelectField inputEx.SliderField inputEx.StringField inputEx.InPlaceEdit inputEx.HiddenField inputEx.TinyMCEField

An abstract class (never instantiated) that contains the shared features for all fields.

### 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

#### 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

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

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

#### close

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

#### destroy

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

#### disable

`void disable ( )`
Disable the field

#### displayMessage

`void displayMessage ( msg )`
Update the message

Parameters:
  `msg <String>` Message to display

#### enable

`void enable ( )`
Enable the field

#### fireUpdatedEvt

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

#### focus

`void 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

#### getParentField

`inputEx.Group|inputEx.Form|inputEx.ListField|inputEx.CombineField getParentField ( )`
Return the parent field instance

#### getState

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

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

#### getStateString

`void getStateString ( )`
Get the string for the given state

#### getValue

`Any getValue ( )`
Return the value of the input

Returns: `Any`
  value of the field

#### hide

`void hide ( )`
Hide the field

#### initEvents

`void initEvents ( )`
Initialize events of the Input

#### isDisabled

`void isDisabled ( )`
Check if the field is diabled

#### isEmpty

`void isEmpty ( )`
Should return true if empty

#### onBlur

`void onBlur ( e )`
Function called on the blur event

Parameters:
  `e <Event>` The original 'blur' event

#### onChange

`void onChange ( e )`
onChange event handler

Parameters:
  `e <Event>` The original 'change' event

#### onFocus

`void onFocus ( e )`
Function called on the focus event

Parameters:
  `e <Event>` The original 'focus' event

#### render

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

#### renderComponent

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

#### setClassFromState

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

#### setFieldName

`void setFieldName ( )`
Set the name of the field (or hidden field)

#### setOptions

`void setOptions ( options )`
Set the default values of the options

Parameters:
  `options <Object>` Options object as passed to the constructor

#### setParentField

`void setParentField ( parentField )`
Set the parentField. Generally use by composable fields (ie. Group,Form,ListField,CombineField,...}

Parameters:
  `parentField <inputEx.Group|inputEx.Form|inputEx.ListField|inputEx.CombineField>` The parent field instance

#### setValue

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

Parameters:
  `value <Any>` The new value
  `[sendUpdatedEvt] <boolean>` (optional) Wether this setValue should fire the updatedEvt or not (default is true, pass false to NOT send the event)

#### show

`void show ( )`
Show the field

#### validate

`Boolean validate ( )`
Validation of the field

Returns: `Boolean`
  field validation status (true/false)

### Events

#### updatedEvt

`updatedEvt ( value )`
Event fired after the user changed the value of the field.

Parameters:
  `value <Any>` The new value of the field

Copyright © 2010 Eric Abouaf All rights reserved.