# inputEx - TimeIntervalField Usage

## Basic TimeIntervalField creation

Use the following code to create a basic inputEx TimeIntervalField.

var field = new inputEx.TimeIntervalField({parentEl: 'container1', label: 'Length',value:82800}); var button = inputEx.cn('button', null, null, 'getValue'); YAHOO.util.Event.addListener(button, "click",function() { alert(field.getValue()+" (seconds)"); }); YAHOO.util.Dom.get('container1').appendChild(button);

## TimeIntervalField options

You can set the fields and separators options of the combine field to customize the field

var units = inputEx.TimeIntervalField.units; var unitsStr = inputEx.messages.timeUnits; var n=[]; for(var i=1;i !=30;i++){ n.push(i); } var fields = [ {type: 'select', choices: n }, { type: 'select', choices: [ { value: units.DAY, label: unitsStr.DAY }, { value: units.MONTH, label: unitsStr.MONTH }, { value: units.YEAR, label: unitsStr.YEAR } ] } ]; new inputEx.TimeIntervalField({ parentEl: 'container2', value: 60*24*2, // 2 days unit: inputEx.TimeIntervalField.units.MINUTE, label: 'Continue', fields: fields, separators: ["for ", " ", false] });