Upgrade to ExtJS 4.0.2 - Released 06/09/2011
[extjs.git] / docs / source / Hidden.html
index 82ccfec..986a9dc 100644 (file)
@@ -1,41 +1,75 @@
+<!DOCTYPE html>
 <html>
 <head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <title>The source code</title>
-    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
-    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
+  <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
+  <script type="text/javascript" src="../prettify/prettify.js"></script>
+  <style type="text/css">
+    .highlight { display: block; background-color: #ddd; }
+  </style>
+  <script type="text/javascript">
+    function highlight() {
+      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
+    }
+  </script>
 </head>
-<body  onload="prettyPrint();">
-    <pre class="prettyprint lang-js">/*!
- * Ext JS Library 3.2.0
- * Copyright(c) 2006-2010 Ext JS, Inc.
- * licensing@extjs.com
- * http://www.extjs.com/license
- */
-<div id="cls-Ext.form.Hidden"></div>/**
- * @class Ext.form.Hidden
- * @extends Ext.form.Field
- * A basic hidden field for storing hidden values in forms that need to be passed in the form submit.
- * @constructor
- * Create a new Hidden field.
- * @param {Object} config Configuration options
- * @xtype hidden
- */
-Ext.form.Hidden = Ext.extend(Ext.form.Field, {
-    // private
-    inputType : 'hidden',
+<body onload="prettyPrint(); highlight();">
+  <pre class="prettyprint lang-js"><span id='Ext-form-field-Hidden'>/**
+</span> * @class Ext.form.field.Hidden
+ * @extends Ext.form.field.Base
+ * &lt;p&gt;A basic hidden field for storing hidden values in forms that need to be passed in the form submit.&lt;/p&gt;
+ * &lt;p&gt;This creates an actual input element with type=&quot;submit&quot; in the DOM. While its label is
+ * {@link #hideLabel not rendered} by default, it is still a real component and may be sized according to
+ * its owner container's layout.&lt;/p&gt;
+ * &lt;p&gt;Because of this, in most cases it is more convenient and less problematic to simply
+ * {@link Ext.form.action.Action#params pass hidden parameters} directly when
+ * {@link Ext.form.Basic#submit submitting the form}.&lt;/p&gt;
+ * &lt;p&gt;Example:&lt;/p&gt;
+ * &lt;pre&gt;&lt;code&gt;new Ext.form.Panel({
+    title: 'My Form',
+    items: [{
+        xtype: 'textfield',
+        fieldLabel: 'Text Field',
+        name: 'text_field',
+        value: 'value from text field'
+    }, {
+        xtype: 'hiddenfield',
+        name: 'hidden_field_1',
+        value: 'value from hidden field'
+    }],
 
-    // private
-    onRender : function(){
-        Ext.form.Hidden.superclass.onRender.apply(this, arguments);
-    },
+    buttons: [{
+        text: 'Submit',
+        handler: function() {
+            this.up('form').getForm().submit({
+                params: {
+                    hidden_field_2: 'value from submit call'
+                }
+            });
+        }
+    }]
+});&lt;/code&gt;&lt;/pre&gt;
+ * &lt;p&gt;Submitting the above form will result in three values sent to the server:
+ * &lt;code&gt;text_field=value+from+text+field&amp;hidden_field_1=value+from+hidden+field&amp;&lt;br&gt;hidden_field_2=value+from+submit+call&lt;/code&gt;&lt;/p&gt;
+ *
+ */
+Ext.define('Ext.form.field.Hidden', {
+    extend:'Ext.form.field.Base',
+    alias: ['widget.hiddenfield', 'widget.hidden'],
+    alternateClassName: 'Ext.form.Hidden',
 
     // private
-    initEvents : function(){
-        this.originalValue = this.getValue();
+    inputType : 'hidden',
+    hideLabel: true,
+    
+    initComponent: function(){
+        this.formItemCls += '-hidden';
+        this.callParent();    
     },
 
     // These are all private overrides
+    initEvents: Ext.emptyFn,
     setSize : Ext.emptyFn,
     setWidth : Ext.emptyFn,
     setHeight : Ext.emptyFn,
@@ -44,6 +78,6 @@ Ext.form.Hidden = Ext.extend(Ext.form.Field, {
     markInvalid : Ext.emptyFn,
     clearInvalid : Ext.emptyFn
 });
-Ext.reg('hidden', Ext.form.Hidden);</pre>    
+</pre>
 </body>
-</html>
\ No newline at end of file
+</html>