inputEx Documentation Back to homepage

### inputEx Documentation > inputEx 0.2.2

## Static Class inputEx

The inputEx global namespace object. Build a field from an object like: { type: 'color' or fieldClass: inputEx.ColorField, inputParams: {} }
The inputParams property is the object that will be passed as the `options` parameter to the field class constructor.
If the neither type or fieldClass are found, it uses inputEx.StringField

### Properties

#### static messages `- Object`

Associative array containing field messages

#### static regexps `- Object`

Associative array containing common regular expressions

#### static spacerUrl `- String`

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

#### static stateEmpty `- String`

Field empty state constant

#### static stateInvalid `- String`

Field invalid state constant

#### static stateRequired `- String`

Field required state constant

#### static stateValid `- String`

Field valid state constant

#### static typeClasses `- Object`

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

#### static visus `- Object`

Contains the various visualization methods

#### static widget `- Object`

### Methods

#### buildField

`static <inputEx.Field> buildField(fieldOptions)`
Kept for backward compatibility
Parameters:

`fieldOptions <Object>`

Returns:

`<inputEx.Field>` Created field instance

#### 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>` optional - see inputEx.sn

`styleAttributes <Object>` optional - see inputEx.sn

`innerHTML <String>` optional - 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

#### formForMethod

`static formForMethod(method)`
Return the inputEx form options from a method
Parameters:

`method <function>` - A method created through YAHOO.rpc.Service

#### generateServiceForm

`static generateServiceForm(method,formOpts,callback)`
Build a form to run a service ! built for yui-rpc
Parameters:

`method <function>` - A method created through YAHOO.rpc.Service

`formOpts <Object>`

`callback`

#### getFieldClass

`static 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)`
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

Returns:

`<number>` Element position, -1 if not found

#### registerType

`static registerType(type,field)`
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`

`field`

#### renderVisu

`static <HTMLElement || String> renderVisu(visuOptions,data,parentEl)`
Render 'data' using a visualization function described by 'visuOptions'
Parameters:

`visuOptions <Object>` - The visu parameters {visuType: 'myType', ...args...}

`data <Object>` - The input data to send to the template

`parentEl <HTMLElement || String>` - optional Set the result as content of parentEl

Returns:

`<HTMLElement || String>` Either the inserted HTMLElement or the String set to parentEl.innerHTML

#### sn

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

`el <HTMLElement>` - The element to set attributes to

`domAttributes <Object>` - 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 (c) 2007-2009 Eric Abouaf. All rights reserved.
Generated by JsDoc Toolkit 2.0.0 on Wed, 04 Mar 2009 15:41:30 GMT using neyricjslibs-template.