NumberTextBox.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. if (!dojo._hasResource["dijit.form.NumberTextBox"]) {
  2. // _hasResource checks added by build. Do not use _hasResource directly in
  3. // your code.
  4. dojo._hasResource["dijit.form.NumberTextBox"] = true;
  5. dojo.provide("dijit.form.NumberTextBox");
  6. dojo.require("dijit.form.ValidationTextBox");
  7. dojo.require("dojo.number");
  8. dojo.declare("dijit.form.NumberTextBoxMixin", null, {
  9. // summary:
  10. // A mixin for all number textboxes
  11. regExpGen : dojo.number.regexp,
  12. format : function(/* Number */value, /* Object */constraints) {
  13. if (isNaN(value)) {
  14. return "";
  15. }
  16. return dojo.number.format(value, constraints);
  17. },
  18. parse : dojo.number.parse,
  19. filter : function(/* Number */value) {
  20. if (typeof value == "string") {
  21. return this.inherited('filter', arguments);
  22. }
  23. return (isNaN(value) ? '' : value);
  24. },
  25. value : NaN
  26. });
  27. dojo.declare("dijit.form.NumberTextBox", [dijit.form.RangeBoundTextBox,
  28. dijit.form.NumberTextBoxMixin], {
  29. // summary:
  30. // A validating, serializable, range-bound text box.
  31. // constraints object: min, max, places
  32. });
  33. }