Upgrade to ExtJS 4.0.7 - Released 10/19/2011
[extjs.git] / src / form / field / Hidden.js
index 5aaa68a..d0f70ee 100644 (file)
@@ -1,46 +1,59 @@
+/*
+
+This file is part of Ext JS 4
+
+Copyright (c) 2011 Sencha Inc
+
+Contact:  http://www.sencha.com/contact
+
+GNU General Public License Usage
+This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file.  Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
+
+If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
+
+*/
 /**
- * @class Ext.form.field.Hidden
- * @extends Ext.form.field.Base
- * <p>A basic hidden field for storing hidden values in forms that need to be passed in the form submit.</p>
- * <p>This creates an actual input element with type="submit" 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.</p>
- * <p>Because of this, in most cases it is more convenient and less problematic to simply
+ * A basic hidden field for storing hidden values in forms that need to be passed in the form submit.
+ *
+ * This creates an actual input element with type="submit" 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.
+ *
+ * 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}.</p>
- * <p>Example:</p>
- * <pre><code>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'
-    }],
-
-    buttons: [{
-        text: 'Submit',
-        handler: function() {
-            this.up('form').getForm().submit({
-                params: {
-                    hidden_field_2: 'value from submit call'
-                }
-            });
-        }
-    }]
-});</code></pre>
- * <p>Submitting the above form will result in three values sent to the server:
- * <code>text_field=value+from+text+field&hidden_field_1=value+from+hidden+field&<br>hidden_field_2=value+from+submit+call</code></p>
+ * {@link Ext.form.Basic#submit submitting the form}.
+ *
+ * Example:
+ *
+ *     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'
+ *         }],
+ *
+ *         buttons: [{
+ *             text: 'Submit',
+ *             handler: function() {
+ *                 this.up('form').getForm().submit({
+ *                     params: {
+ *                         hidden_field_2: 'value from submit call'
+ *                     }
+ *                 });
+ *             }
+ *         }]
+ *     });
+ *
+ * Submitting the above form will result in three values sent to the server:
+ *
+ *     text_field=value+from+text+field&hidden;_field_1=value+from+hidden+field&hidden_field_2=value+from+submit+call
  *
- * @constructor
- * Create a new Hidden field.
- * @param {Object} config Configuration options
- * 
- * @xtype hiddenfield
  */
 Ext.define('Ext.form.field.Hidden', {
     extend:'Ext.form.field.Base',
@@ -55,6 +68,14 @@ Ext.define('Ext.form.field.Hidden', {
         this.formItemCls += '-hidden';
         this.callParent();    
     },
+    
+    /**
+     * @private
+     * Override. Treat undefined and null values as equal to an empty string value.
+     */
+    isEqual: function(value1, value2) {
+        return this.isEqualAsString(value1, value2);
+    },
 
     // These are all private overrides
     initEvents: Ext.emptyFn,
@@ -66,3 +87,4 @@ Ext.define('Ext.form.field.Hidden', {
     markInvalid : Ext.emptyFn,
     clearInvalid : Ext.emptyFn
 });
+