slider.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Ext JS Library 2.0 Copyright(c) 2006-2007, Ext JS, LLC. licensing@extjs.com
  3. *
  4. * http://extjs.com/license
  5. */
  6. Ext.onReady(function() {
  7. Ext.QuickTips.init();
  8. // turn on validation errors beside the field globally
  9. Ext.form.Field.prototype.msgTarget = 'side';
  10. var bd = Ext.getBody();
  11. /*
  12. * ================ Simple form =======================
  13. */
  14. bd.createChild({
  15. tag : 'h2',
  16. html : 'Form 1 - Very Simple'
  17. });
  18. var simple = new Ext.FormPanel({
  19. labelWidth : 75, // label settings here cascade
  20. // unless overridden
  21. url : 'echo.php',
  22. frame : true,
  23. title : 'Simple Form',
  24. bodyStyle : 'padding:5px 5px 0',
  25. width : 350,
  26. defaults : {
  27. width : 230
  28. },
  29. defaultType : 'textfield',
  30. items : [{
  31. fieldLabel : 'First Name',
  32. name : 'first',
  33. allowBlank : true
  34. }, {
  35. fieldLabel : 'Last Name',
  36. name : 'last'
  37. }, {
  38. fieldLabel : 'Company',
  39. name : 'company'
  40. }, {
  41. fieldLabel : 'Email',
  42. name : 'email',
  43. vtype : 'email'
  44. }, new Ext.form.TimeField({
  45. fieldLabel : 'Time',
  46. name : 'time',
  47. minValue : '8:00am',
  48. maxValue : '6:00pm'
  49. }), {
  50. xtype : 'sliderfield',
  51. name : 'slider1',
  52. minValue : 0,
  53. maxValue : 100,
  54. fieldLabel : 'Slider'
  55. }
  56. ],
  57. buttons : [{
  58. text : 'Save',
  59. handler : function() {
  60. simple.getForm().submit({
  61. success : function(form, action) {
  62. alert('Success:\n'
  63. + action.response.responseText);
  64. },
  65. failure : function(form, action) {
  66. alert('Failure: ' + action.failureType);
  67. }
  68. });
  69. }
  70. }, {
  71. text : 'Cancel'
  72. }]
  73. });
  74. simple.render(document.body);
  75. });