Hidden.html 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js"><span id='Ext-form-field-Hidden'>/**
  19. </span> * A basic hidden field for storing hidden values in forms that need to be passed in the form submit.
  20. *
  21. * This creates an actual input element with type=&quot;submit&quot; in the DOM. While its label is
  22. * {@link #hideLabel not rendered} by default, it is still a real component and may be sized according
  23. * to its owner container's layout.
  24. *
  25. * Because of this, in most cases it is more convenient and less problematic to simply
  26. * {@link Ext.form.action.Action#params pass hidden parameters} directly when
  27. * {@link Ext.form.Basic#submit submitting the form}.
  28. *
  29. * Example:
  30. *
  31. * new Ext.form.Panel({
  32. * title: 'My Form',
  33. * items: [{
  34. * xtype: 'textfield',
  35. * fieldLabel: 'Text Field',
  36. * name: 'text_field',
  37. * value: 'value from text field'
  38. * }, {
  39. * xtype: 'hiddenfield',
  40. * name: 'hidden_field_1',
  41. * value: 'value from hidden field'
  42. * }],
  43. *
  44. * buttons: [{
  45. * text: 'Submit',
  46. * handler: function() {
  47. * this.up('form').getForm().submit({
  48. * params: {
  49. * hidden_field_2: 'value from submit call'
  50. * }
  51. * });
  52. * }
  53. * }]
  54. * });
  55. *
  56. * Submitting the above form will result in three values sent to the server:
  57. *
  58. * text_field=value+from+text+field&amp;hidden;_field_1=value+from+hidden+field&amp;hidden_field_2=value+from+submit+call
  59. *
  60. */
  61. Ext.define('Ext.form.field.Hidden', {
  62. extend:'Ext.form.field.Base',
  63. alias: ['widget.hiddenfield', 'widget.hidden'],
  64. alternateClassName: 'Ext.form.Hidden',
  65. // private
  66. inputType : 'hidden',
  67. hideLabel: true,
  68. initComponent: function(){
  69. this.formItemCls += '-hidden';
  70. this.callParent();
  71. },
  72. <span id='Ext-form-field-Hidden-method-isEqual'> /**
  73. </span> * @private
  74. * Override. Treat undefined and null values as equal to an empty string value.
  75. */
  76. isEqual: function(value1, value2) {
  77. return this.isEqualAsString(value1, value2);
  78. },
  79. // These are all private overrides
  80. initEvents: Ext.emptyFn,
  81. setSize : Ext.emptyFn,
  82. setWidth : Ext.emptyFn,
  83. setHeight : Ext.emptyFn,
  84. setPosition : Ext.emptyFn,
  85. setPagePosition : Ext.emptyFn,
  86. markInvalid : Ext.emptyFn,
  87. clearInvalid : Ext.emptyFn
  88. });
  89. </pre>
  90. </body>
  91. </html>