Use the following code to create a basic inputEx NumberField.
1 | field = new inputEx.NumberField({parentEl: 'container1', showMsg: true, value: 0.03}); |
2 | var button = inputEx.cn('button', null, null, 'getValue'); |
3 | YAHOO.util.Event.addListener(button, "click",function() { |
4 | alert(field.getValue()); |
5 | }); |
6 | YAHOO.util.Dom.get('container1').appendChild(button); |
view plain | print | ? |
Everything accepted by parseFloat is valid.
1 | field2 = new inputEx.NumberField({parentEl: 'container2', showMsg: true, value: '03e-2', required:true, typeInvite:"Float numbers accepted"}); |
2 | var button = inputEx.cn('button', null, null, 'getValue'); |
3 | YAHOO.util.Event.addListener(button, "click",function() { |
4 | alert(field2.getValue()); |
5 | }); |
6 | YAHOO.util.Dom.get('container2').appendChild(button); |
view plain | print | ? |
Check a minimum or a maximum value
1 | field3 = new inputEx.NumberField({parentEl: 'container3', showMsg: true, min:-15, max:'1e3', typeInvite:"Numbers between -15 and 1e3 (1000) only", size:40}); |
2 | var button = inputEx.cn('button', null, null, 'getValue'); |
3 | YAHOO.util.Event.addListener(button, "click",function() { |
4 | alert(field3.getValue()); |
5 | }); |
6 | YAHOO.util.Dom.get('container3').appendChild(button); |
view plain | print | ? |