# inputEx-library

### inputEx 0.5.1

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

## `static` Class inputEx

The inputEx method lets you create a field from the JSON definition:

    inputEx({type: 'string', name: 'company', label: 'Your company' })

Build a field from an object like: { type: 'color' or fieldClass: inputEx.ColorField, ... }
If the neither type or fieldClass are found, it uses inputEx.StringField

### Properties

#### browserAutocomplete - `object`

Property to globally turn on/off the browser autocompletion (used as default autocomplete option value by StringField, Form and their subclasses)

#### messages - `object`

Associative array containing field messages

#### mixin - `static object`

inputEx mixin namespace

#### regexps - `object`

Associative array containing common regular expressions

#### spacerUrl - `String`

Url to the spacer image. This url schould be changed according to your project directories

#### stateEmpty - `String`

Field empty state constant

#### stateInvalid - `String`

Field invalid state constant

#### stateRequired - `String`

Field required state constant

#### stateValid - `String`

Field valid state constant

#### typeClasses - `object`

Hash between inputEx types and classes (ex: `inputEx.typeClasses.color = inputEx.ColorField`)
Please register the types with the `registerType` method

#### widget - `static object`

inputEx widget namespace

### Methods

#### buildField

`inputEx.Field buildField ( fieldOptions )`

Parameters:
  `fieldOptions <Object>`

Returns: `inputEx.Field`
  Created field instance

Deprecated Kept for backward compatibility (alias for inputEx() )

#### cn

`static HTMLElement cn ( tag , [domAttributes] , [styleAttributes] , [innerHTML] )`
Helper function to create a DOM node. (wrapps the document.createElement tag and the inputEx.sn functions)

Parameters:
  `tag <String>` The tagName to create (ex: 'div', 'a', ...)
  `[domAttributes] <Object>` see inputEx.sn
  `[styleAttributes] <Object>` see inputEx.sn
  `[innerHTML] <String>` The html string to append into the created element

Returns: `HTMLElement`
  The created node

#### compactArray

`static Array compactArray ( arr )`
Create a new array without the null or undefined values

Parameters:
  `arr <Array>` The array to compact

Returns: `Array`
  The new array

#### getFieldClass

`static void getFieldClass ( type )`
Returns the class for the given type ex: inputEx.getFieldClass("color") returns inputEx.ColorField

Parameters:
  `type <String>` String type of the field

#### getType

`static String getType ( FieldClass )`
Get the inputex type for the given class (ex: `inputEx.getType(inputEx.ColorField)` returns "color")

Parameters:
  `FieldClass <inputEx.Field>` An inputEx.Field or derivated class

Returns: `String`
  returns the inputEx type string or `null`

#### indexOf

`static number indexOf ( el , arr , (optional) )`
Find the position of the given element. (This method is not available in IE 6)

Parameters:
  `el <Object>` Value to search
  `arr <Array>` The array to search
  `(optional) <Function>` fn A function to define another way to test inclusion of el than === (returns a boolean)

Returns: `number`
  Element position, -1 if not found

#### registerType

`static void registerType ( type , fieldClass , groupOptions , dontInherit )`
When you create a new inputEx Field Class, you can register it to give it a simple type. ex: inputEx.registerType("color", inputEx.ColorField);

Parameters:
  `type <String>` String used as the inputEx field type
  `fieldClass <Class>` Field Class to register as this type
  `groupOptions <Array>` List of inputEx field description for each option
  `dontInherit <Boolean>` Won't inherhit the parent field properties if set to true

#### removeAccents

`static String removeAccents ( str )`
Return a string without accent (only on lowercase)

Parameters:
  `str <String>` The string

Returns: `String`
  String without accent

#### sn

`static void sn ( el , ) , styleAttributes )`
Helper function to set DOM node attributes and style attributes.

Parameters:
  `el <HTMLElement>` The element to set attributes to
  `) <Object} domAttributes An object containing key/value pairs to set as node attributes (ex: {id: 'myElement', className: 'myCssClass', ...>`
  `styleAttributes <Object>` Same thing for style attributes. Please use camelCase for style attributes (ex: backgroundColor for 'background-color')

Copyright © 2010 Eric Abouaf All rights reserved.