# inputEx - KeyValueField Usage

## Basic KeyValueField creation

The KeyValueField makes it easy to build a search form from an existing inputEx definition

var field = new inputEx.KeyValueField({ parentEl: 'container1', availableFields: [ {type: 'string', name: 'lastname', label: 'Lastname' }, {type: 'string', name: 'firstname', label: 'Firstname' }, {type: 'select', name: 'gender', label: 'Gender', choices: ["Mr","Mrs","Ms"] } ] }); var button = inputEx.cn('button', null, null, 'getValue()'); YAHOO.util.Dom.get('container1').appendChild(button); YAHOO.util.Event.addListener(button, 'click', function() { alert( YAHOO.lang.JSON.stringify(field.getValue())); });