Use the following code to create a basic inputEx NumberField.
field = new Y.inputEx.NumberField({parentEl: 'container1', showMsg: true, value: 0.03}); var button = inputEx.cn('button', null, null, 'getValue'); Y.one(button).on('click',function() { alert(field.getValue()); }); Y.one('#container1').appendChild(button);
Everything accepted by parseFloat is valid.
field2 = new Y.inputEx.NumberField({parentEl: 'container2', showMsg: true, value: '03e-2', required:true, typeInvite:"Float numbers accepted"}); var button = inputEx.cn('button', null, null, 'getValue'); Y.one(button).on('click',function() { alert(field2.getValue()); }); Y.one('#container2').appendChild(button);
Check a minimum or a maximum value
field3 = new Y.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'); Y.one(button).on('click',function() { alert(field3.getValue()); }); Y.one('#container3').appendChild(button);