-<html>
-<head>
- <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>
-</head>
-<body onload="prettyPrint();">
- <pre class="prettyprint lang-js">/*!
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
- */
-<div id="cls-Ext.form.Field"></div>/**
+<html>\r
+<head>\r
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> \r
+ <title>The source code</title>\r
+ <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
+ <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
+</head>\r
+<body onload="prettyPrint();">\r
+ <pre class="prettyprint lang-js"><div id="cls-Ext.form.Field"></div>/**
* @class Ext.form.Field
* @extends Ext.BoxComponent
* Base class for form fields that provides default event handling, sizing, value handling and other functionality.
* @xtype field
*/
Ext.form.Field = Ext.extend(Ext.BoxComponent, {
+ <div id="prop-Ext.form.Field-label"></div>/**
+ * <p>The label Element associated with this Field. <b>Only available after this Field has been rendered by a
+ * {@link form Ext.layout.FormLayout} layout manager.</b></p>
+ * @type Ext.Element
+ * @property label
+ */
<div id="cfg-Ext.form.Field-inputType"></div>/**
* @cfg {String} inputType The type attribute for input fields -- e.g. radio, text, password, file (defaults
* to 'text'). The types 'file' and 'password' must be used to render those field types currently -- there are
* @cfg {String} fieldClass The default CSS class for the field (defaults to 'x-form-field')
*/
fieldClass : 'x-form-field',
- <div id="cfg-Ext.form.Field-msgTarget"></div>/**
- * @cfg {String} msgTarget The location where error text should display. Should be one of the following values
- * (defaults to 'qtip'):
- *<pre>
-Value Description
------------ ----------------------------------------------------------------------
-qtip Display a quick tip when the user hovers over the field
-title Display a default browser title attribute popup
-under Add a block div beneath the field containing the error text
-side Add an error icon to the right of the field with a popup on hover
-[element id] Add the error text directly to the innerHTML of the specified element
-</pre>
+ <div id="cfg-Ext.form.Field-msgTarget<p>The"></div>/**
+ * @cfg {String} msgTarget<p>The location where the message text set through {@link #markInvalid} should display.
+ * Must be one of the following values:</p>
+ * <div class="mdetail-params"><ul>
+ * <li><code>qtip</code> Display a quick tip containing the message when the user hovers over the field. This is the default.
+ * <div class="subdesc"><b>{@link Ext.QuickTips#init Ext.QuickTips.init} must have been called for this setting to work.</b></div</li>
+ * <li><code>title</code> Display the message in a default browser title attribute popup.</li>
+ * <li><code>under</code> Add a block div beneath the field containing the error message.</li>
+ * <li><code>side</code> Add an error icon to the right of the field, displaying the message in a popup on hover.</li>
+ * <li><code>[element id]</code> Add the error message directly to the innerHTML of the specified element.</li>
+ * </ul></div>
*/
msgTarget : 'qtip',
<div id="cfg-Ext.form.Field-msgFx"></div>/**
* disabled Fields will not be {@link Ext.form.BasicForm#submit submitted}.</p>
*/
disabled : false,
+ <div id="cfg-Ext.form.Field-submitValue"></div>/**
+ * @cfg {Boolean} submitValue False to clear the name attribute on the field so that it is not submitted during a form post.
+ * Defaults to <tt>true</tt>.
+ */
+ submitValue: true,
// private
isFormField : true,
this.autoEl = cfg;
}
Ext.form.Field.superclass.onRender.call(this, ct, position);
-
+ if(this.submitValue === false){
+ this.el.dom.removeAttribute('name');
+ }
var type = this.el.dom.type;
if(type){
if(type == 'password'){
this.el.addClass('x-form-'+type);
}
if(this.readOnly){
- this.el.dom.readOnly = true;
+ this.setReadOnly(true);
}
if(this.tabIndex !== undefined){
this.el.dom.setAttribute('tabIndex', this.tabIndex);
}
return String(this.getValue()) !== String(this.originalValue);
},
+
+ <div id="method-Ext.form.Field-setReadOnly"></div>/**
+ * Sets the read only state of this field.
+ * @param {Boolean} readOnly Whether the field should be read only.
+ */
+ setReadOnly : function(readOnly){
+ if(this.rendered){
+ this.el.dom.readOnly = readOnly;
+ }
+ this.readOnly = readOnly;
+ },
// private
afterRender : function(){
}
if(!this.hasFocus){
this.hasFocus = true;
+ <div id="prop-Ext.form.Field-startValue"></div>/**
+ * <p>The value that the Field had at the time it was last focused. This is the value that is passed
+ * to the {@link #change} event which is fired if the value has been changed when the Field is blurred.</p>
+ * <p><b>This will be undefined until the Field has been visited.</b> Compare {@link #originalValue}.</p>
+ * @type mixed
+ * @property startValue
+ */
this.startValue = this.getValue();
this.fireEvent('focus', this);
}
this.el.removeClass(this.focusClass);
}
this.hasFocus = false;
- if(this.validationEvent !== false && (this.validateOnBlur || this.validationEvent != 'blur')){
+ if(this.validationEvent !== false && (this.validateOnBlur || this.validationEvent == 'blur')){
this.validate();
}
var v = this.getValue();
validateValue : function(value){
return true;
},
+
+ <div id="method-Ext.form.Field-getActiveError"></div>/**
+ * Gets the active error message for this field.
+ * @return {String} Returns the active error message on the field, if there is no error, an empty string is returned.
+ */
+ getActiveError : function(){
+ return this.activeError || '';
+ },
<div id="method-Ext.form.Field-markInvalid"></div>/**
- * Mark this field as invalid, using {@link #msgTarget} to determine how to
- * display the error and applying {@link #invalidClass} to the field's element.
- * <b>Note</b>: this method does not actually make the field
+ * <p>Display an error message associated with this field, using {@link #msgTarget} to determine how to
+ * display the message and applying {@link #invalidClass} to the field's UI element.</p>
+ * <p><b>Note</b>: this method does not cause the Field's {@link #validate} method to return <code>false</code>
+ * if the value does <i>pass</i> validation. So simply marking a Field as invalid will not prevent
+ * submission of forms submitted with the {@link Ext.form.Action.Submit#clientValidation} option set.</p>
* {@link #isValid invalid}.
* @param {String} msg (optional) The validation message (defaults to {@link #invalidText})
*/
t.style.display = this.msgDisplay;
}
}
+ this.activeError = msg;
this.fireEvent('invalid', this, msg);
},
t.style.display = 'none';
}
}
+ delete this.activeError;
this.fireEvent('valid', this);
},
}
};
Ext.reg('field', Ext.form.Field);
-</pre>
-</body>
+</pre> \r
+</body>\r
</html>
\ No newline at end of file