/source/Plug-in/ext/colorpicker/test.html

http://prosporous.googlecode.com/ · HTML · 93 lines · 89 code · 4 blank · 0 comment · 0 complexity · 707764bae777069bc8047ddf743c2a52 MD5 · raw file

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>ColorPickerField Test</title>
  6. <link rel='stylesheet' type='text/css' href='../ext/resources/css/ext-all.css' />
  7. <link rel="stylesheet" type="text/css" href="colorpicker.css" />
  8. <script type="text/javascript" src="../ext/adapter/ext/ext-base.js"></script>
  9. <script type="text/javascript" src="../ext/ext-all-debug.js"></script>
  10. <script type="text/javascript" src="../fieldpanel/fieldpanel.js"></script>
  11. <script type="text/javascript" src="colorpicker.js"></script>
  12. <script type="text/javascript" src="colorpickerfield.js"></script>
  13. <script type="text/javascript">
  14. Ext.QuickTips.init();
  15. Ext.form.Field.prototype.msgTarget = 'side';
  16. Ext.onReady(function(){
  17. var valid=true;
  18. var enable=true;
  19. var win = new Ext.Window({
  20. renderTo: document.body,
  21. title: "ColorPicker Test",
  22. width: 600,
  23. height: 400,
  24. items: [{
  25. xtype: 'form',
  26. border: false,
  27. bodyStyle: 'background-color:#DFE8F6; padding-top:10px',
  28. labelAlign: 'right',
  29. labelWidth: 50,
  30. items: [{
  31. xtype: 'textfield',
  32. fieldLabel: 'Name',
  33. name: 'name'
  34. }, {
  35. xtype: 'colorpickerfield',
  36. fieldLabel: 'Color',
  37. name: 'color',
  38. value: '123456'
  39. }]
  40. }],
  41. buttons:[{
  42. text:"Invalid",
  43. handler:function(){
  44. var form=win.getComponent(0).getForm();
  45. var n=form.findField('name');
  46. var c=form.findField('color');
  47. if (valid) {
  48. n.markInvalid();
  49. c.markInvalid();
  50. valid = false;
  51. } else {
  52. n.clearInvalid();
  53. c.clearInvalid();
  54. valid = true;
  55. }
  56. }
  57. }, {
  58. text:"Disable",
  59. handler: function(){
  60. var form=win.getComponent(0).getForm();
  61. var n=form.findField('name');
  62. var c=form.findField('color');
  63. if (enable) {
  64. n.disable();
  65. c.disable();
  66. enable = false;
  67. } else {
  68. n.enable();
  69. c.enable();
  70. enable = true;
  71. }
  72. }
  73. }, {
  74. text:"Values",
  75. handler: function(){
  76. var form=win.getComponent(0).getForm();
  77. var n=form.findField('name');
  78. var c=form.findField('color');
  79. Ext.Msg.alert("Value", "Name: "+n.getValue()+"<br />Color: "+c.getValue());
  80. }
  81. }]
  82. });
  83. win.show();
  84. });
  85. </script>
  86. </head>
  87. <body>
  88. </body>
  89. </html>