X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..92c2b89db26be16707f4a805d3303ab2531006e1:/src/widgets/form/TextField.js?ds=inline diff --git a/src/widgets/form/TextField.js b/src/widgets/form/TextField.js index 2ecaa217..bf7fdafd 100644 --- a/src/widgets/form/TextField.js +++ b/src/widgets/form/TextField.js @@ -1,6 +1,6 @@ /*! - * Ext JS Library 3.0.0 - * Copyright(c) 2006-2009 Ext JS, LLC + * Ext JS Library 3.1.1 + * Copyright(c) 2006-2010 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license */ @@ -11,44 +11,10 @@ * or as the base class for more sophisticated input controls (like {@link Ext.form.TextArea} * and {@link Ext.form.ComboBox}).
*Validation
- *Field validation is processed in a particular order. If validation fails at any particular - * step the validation routine halts.
+ *The validation procedure is described in the documentation for {@link #validateValue}.
+ *Alter Validation Behavior
+ *Validation behavior for each field can be configured:
*If a field is configured with a {@link Ext.form.TextField#validator validator}
function,
- * it will be passed the current field value. The {@link Ext.form.TextField#validator validator}
- * function is expected to return boolean true if the value is valid or return a string to
- * represent the invalid message if invalid.
Basic validation is affected with the following configuration properties:
- *- * Validation Invalid Message - *- *{@link Ext.form.TextField#allowBlank allowBlank} {@link Ext.form.TextField#emptyText emptyText}
- *{@link Ext.form.TextField#minLength minLength} {@link Ext.form.TextField#minLengthText minLengthText}
- *{@link Ext.form.TextField#maxLength maxLength} {@link Ext.form.TextField#maxLengthText maxLengthText}
- *
Using VTypes offers a convenient way to reuse validation. If a field is configured with a
- * {@link Ext.form.TextField#vtype vtype}
, the corresponding {@link Ext.form.VTypes VTypes}
- * validation function will be used for validation. If invalid, either the field's
- * {@link Ext.form.TextField#vtypeText vtypeText}
or the VTypes vtype Text property will be
- * used for the invalid message. Keystrokes on the field will be filtered according to the VTypes
- * vtype Mask property.
Each field may also specify a {@link Ext.form.TextField#regex regex}
test.
- * The invalid message for this test is configured with
- * {@link Ext.form.TextField#regexText regexText}
.
Validation behavior for each field can be configured:
{@link Ext.form.TextField#invalidText invalidText}
: the default validation message to
* show if any validation step above does not provide a message when invalid{@link Ext.form.TextField#maskRe maskRe}
: filter out keystrokes before any validation occurs{@link Ext.form.Field#validateOnBlur validateOnBlur}
,
* {@link Ext.form.Field#validationDelay validationDelay}
, and
* {@link Ext.form.Field#validationEvent validationEvent}
: modify how/when validation is triggeredA custom validation function to be called during field validation ({@link #validateValue}) * (defaults to null). If specified, this function will be called first, allowing the - * developer to override the default validation process. This function will be passed the current - * field value and expected to return boolean true if the value is valid or a string - * error message if invalid. + * developer to override the default validation process.
+ *This function will be passed the following Parameters:
+ *value
: Mixed
+ * This function is to Return:
+ *true
: Boolean
+ * true
if the value is validmsg
: String
+ * Validates a value according to the field's validation rules and marks the field as invalid + * if the validation fails. Validation rules are processed in the following order:
+ *A validator offers a way to customize and reuse a validation specification.
+ * If a field is configured with a {@link #validator}
+ * function, it will be passed the current field value. The {@link #validator}
+ * function is expected to return either:
+ *
If the {@link #validator}
has not halted validation,
+ * basic validation proceeds as follows:
{@link #allowBlank}
: (Invalid message =
+ * {@link #emptyText}
){@link #allowBlank}
, a
+ * blank field will cause validation to halt at this step and return
+ * Boolean true or false accordingly.
+ * {@link #minLength}
: (Invalid message =
+ * {@link #minLengthText}
){@link #minLength}
+ * specified, validation halts.
+ * {@link #maxLength}
: (Invalid message =
+ * {@link #maxLengthText}
){@link #maxLength}
+ * specified, validation halts.
+ * If none of the prior validation steps halts validation, a field
+ * configured with a {@link #vtype}
will utilize the
+ * corresponding {@link Ext.form.VTypes VTypes} validation function.
+ * If invalid, either the field's {@link #vtypeText}
or
+ * the VTypes vtype Text property will be used for the invalid message.
+ * Keystrokes on the field will be filtered according to the VTypes
+ * vtype Mask property.
If none of the prior validation steps halts validation, a field's
+ * configured {@link #regex}
test will be processed.
+ * The invalid message for this test is configured with
+ * {@link #regexText}
.