# inputEx - NumberField Usage

## Basic NumberField creation

Use the following code to create a basic inputEx NumberField.

field = new inputEx.NumberField({parentEl: 'container1', showMsg: true, value: 0.03}); var button = inputEx.cn('button', null, null, 'getValue'); YAHOO.util.Event.addListener(button, "click",function() { alert(field.getValue()); }); YAHOO.util.Dom.get('container1').appendChild(button);

## Supported format

Everything accepted by parseFloat is valid.

field2 = new inputEx.NumberField({parentEl: 'container2', showMsg: true, value: '03e-2', required:true, typeInvite:"Float numbers accepted"}); var button = inputEx.cn('button', null, null, 'getValue'); YAHOO.util.Event.addListener(button, "click",function() { alert(field2.getValue()); }); YAHOO.util.Dom.get('container2').appendChild(button);

## Min & Max

Check a minimum or a maximum value

field3 = new inputEx.NumberField({parentEl: 'container3', showMsg: true, min:-15, max:'1e3', typeInvite:"Numbers between -15 and 1e3 (1000) only", size:40}); var button = inputEx.cn('button', null, null, 'getValue'); YAHOO.util.Event.addListener(button, "click",function() { alert(field3.getValue()); }); YAHOO.util.Dom.get('container3').appendChild(button);