# inputEx-library

### inputEx 0.5.1

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

## Class inputEx.Group - extends inputEx.Field

Known Subclasses:
  inputEx.Lens inputEx.CombineField inputEx.Form

Handle a group of fields

### Constructor

inputEx.Group `( )`

Parameters:
  `<Object} options The following options are added for Groups and subclasses:
  - fields: Array of input fields declared like { label: 'Enter the value:' , type: 'text' or fieldClass: inputEx.Field, optional: true/false, ...
  >`
  - legend: The legend for the fieldset (default is an empty string)
  - collapsible: Boolean to make the group collapsible (default is false)
  - collapsed: If collapsible only, will be collapsed at creation (default is false)
  - flatten:

#### Properties inherited from inputEx.Field:

`options`

### Methods

#### clear

`void clear ( [sendUpdatedEvt] )`
Clear all subfields

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 group (recursively calls "close" on each field, does NOT hide the group ) Call this function before hidding the group to close any field popup

#### destroy

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

#### disable

`void disable ( )`
Disable all fields in the group

#### enable

`void enable ( )`
Enable all fields in the group

#### focus

`void focus ( )`
Set the focus to the first input in the group

#### getFieldByName

`void getFieldByName ( fieldName )`
Return the sub-field instance by its name property

Parameters:
  `fieldName <String>` The name property

#### getFieldsStates

`void getFieldsStates ( )`
Alternative method to validate for advanced error handling

#### getValue

`void getValue ( )`
Return an object with all the values of the fields

#### initEvents

`void initEvents ( )`
Add a listener for the 'collapsible' option

#### onChange

`void onChange ( eventName , args )`
Called when one of the group subfields is updated.

Parameters:
  `eventName <String>` Event name
  `args <Array>` Array of [fieldValue, fieldInstance]

#### render

`void render ( )`
Render the group

#### renderField

`void renderField ( fieldOptions )`
Instanciate one field given its parameters, type or fieldClass

Parameters:
  `fieldOptions <Object>` The field properties as required by the inputEx() method

#### renderFields

`void renderFields ( )`
Render all the fields. We use the parentEl so that inputEx.Form can append them to the FORM tag

#### runAction

`void runAction ( action , triggerValue )`
Run an action (for interactions)

Parameters:
  `action <Object>` inputEx action object
  `triggerValue <Any>` The value that triggered the interaction

#### runFieldsInteractions

`void runFieldsInteractions ( )`
Run the interactions for all fields

#### runInteractions

`void runInteractions ( fieldInstance , fieldValue )`
Run the interactions for the given field instance

Parameters:
  `fieldInstance <inputEx.Field>` Field that just changed
  `fieldValue <Any>` Field value

#### setErrors

`void setErrors ( errors )`
Write error messages for fields as specified in the hash

Parameters:
  `errors <Object || Array>` Hash object containing error messages as Strings referenced by the field name, or array [ ["fieldName", "Message"], ...]

#### setOptions

`void setOptions ( options )`
Adds some options: legend, collapsible, fields...

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

#### setValue

`void setValue ( value , [sendUpdatedEvt] )`
Set the values of each field from a key/value hash object

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

#### toggleCollapse

`void toggleCollapse ( )`
Toggle the collapse state

#### validate

`void validate ( )`
Validate each field

#### Methods inherited from inputEx.Field:

`clear, close, destroy, disable, displayMessage, enable, fireUpdatedEvt, focus, getEl, getParentField, getState, getStateString, getValue, hide, initEvents, isDisabled, isEmpty, onBlur, onChange, onFocus, render, renderComponent, setClassFromState, setFieldName, setOptions, setParentField, setValue, show, validate`

#### Events inherited from inputEx.Field:

`updatedEvt,`

Copyright © 2010 Eric Abouaf All rights reserved.