# inputEx - MultiSelectField Usage

## Basic MultiSelectField creation

Use the following code to create a basic inputEx MultiSelectField. The first value of "options" is used as the invite text to select an option.

var ms = new inputEx.MultiSelectField({ label: 'Javascript libraries you use', name: 'country', choices: [{ value: 'Choose a library' }, { value: 'YUI' }, { value: 'Dojo' }, { value: 'Prototype' }, { value: 'Scriptaculous'}, { value: 'Mootools' }], parentEl: 'container1', description: 'Select and order your favorite libraries' }); ms.updatedEvt.subscribe(function(e,params) { var value = YAHOO.lang.JSON.stringify(params[0]); YAHOO.util.Dom.get('container1').appendChild( inputEx.cn('div',null,null,"Updated at "+(new Date())+" "+value) ); });

## Change returned values

As SelectField, MultiSelect field allow to set the labels for the options

var ms = new inputEx.MultiSelectField({ label: 'Javascript libraries you use', name: 'country', choices: [ { value: null, label: 'Choose a library' }, { value: 'yui', label: 'YUI' }, { value: 'dojo', label: 'Dojo' }, { value: 'prototype', label: 'Prototype' }, { value: 'scriptaculous', label: 'Scriptaculous'}, { value: 'mootools', label: 'Mootools' } ], parentEl: 'container2', description: 'Select and order your favorite libraries' }); ms.updatedEvt.subscribe(function(e,params) { var value = YAHOO.lang.JSON.stringify(params[0]); YAHOO.util.Dom.get('container2').appendChild( inputEx.cn('div',null,null,"Updated at "+(new Date())+" "+value) ); });