X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/0494b8d9b9bb03ab6c22b34dae81261e3cd7e3e6..7a654f8d43fdb43d78b63d90528bed6e86b608cc:/docs/api/Ext.form.field.VTypes.html diff --git a/docs/api/Ext.form.field.VTypes.html b/docs/api/Ext.form.field.VTypes.html new file mode 100644 index 00000000..e21de46d --- /dev/null +++ b/docs/api/Ext.form.field.VTypes.html @@ -0,0 +1,127 @@ +Ext.form.field.VTypes | Ext JS 4.0 Documentation +
For up to date documentation and features, visit +http://docs.sencha.com/ext-js/4-0

Sencha Documentation

+ + + + + +

This is a singleton object which contains a set of commonly used field validation functions. +The validations provided are basic and intended to be easily customizable and extended.

+ + +

To add custom VTypes specify the vtype validation +test function, and optionally specify any corresponding error text to display and any keystroke +filtering mask to apply. For example:

+ + +
// custom Vtype for vtype:'time'
+var timeTest = /^([1-9]|1[0-9]):([0-5][0-9])(\s[a|p]m)$/i;
+Ext.apply(Ext.form.field.VTypes, {
+    //  vtype validation function
+    time: function(val, field) {
+        return timeTest.test(val);
+    },
+    // vtype Text property: The error text to display when the validation function returns false
+    timeText: 'Not a valid time.  Must be in the format "12:34 PM".',
+    // vtype Mask property: The keystroke filter mask
+    timeMask: /[\d\s:amp]/i
+});
+
+ + +

Another example:

+ +
// custom Vtype for vtype:'IPAddress'
+Ext.apply(Ext.form.field.VTypes, {
+    IPAddress:  function(v) {
+        return /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(v);
+    },
+    IPAddressText: 'Must be a numeric IP address',
+    IPAddressMask: /[\d\.]/i
+});
+
+ +
Defined By

Properties

 

The keystroke filter mask to be applied on alpha input. Defaults to: +/[a-z_]/i

+

The keystroke filter mask to be applied on alpha input. Defaults to: +/[a-z_]/i

+
 
The error text to display when the alpha validation function returns false. Defaults to: +'This field should only con...

The error text to display when the alpha validation function returns false. Defaults to: +'This field should only contain letters and _'

+
 

The keystroke filter mask to be applied on alphanumeric input. Defaults to: +/[a-z0-9_]/i

+

The keystroke filter mask to be applied on alphanumeric input. Defaults to: +/[a-z0-9_]/i

+
 
The error text to display when the alphanumeric validation function returns false. Defaults to: +'This field should o...

The error text to display when the alphanumeric validation function returns false. Defaults to: +'This field should only contain letters, numbers and _'

+
 
The keystroke filter mask to be applied on email input. See the email method for +information about more complex emai...

The keystroke filter mask to be applied on email input. See the email method for +information about more complex email validation. Defaults to: +/[a-z0-9_.-@]/i

+
 
The error text to display when the email validation function returns false. Defaults to: +'This field should be an e-...

The error text to display when the email validation function returns false. Defaults to: +'This field should be an e-mail address in the format "user@example.com"'

+
 
The error text to display when the url validation function returns false. Defaults to: +'This field should be a URL i...

The error text to display when the url validation function returns false. Defaults to: +'This field should be a URL in the format "http:/'+'/www.example.com"'

+
Defined By

Methods

 
alpha( +String value) + : Boolean

The function used to validate alpha values

+

The function used to validate alpha values

+

Parameters

  • value : String

    The value

    +

Returns

  • Boolean   

    true if the RegExp test passed, and false if not.

    +
 
alphanum( +String value) + : Boolean

The function used to validate alphanumeric values

+

The function used to validate alphanumeric values

+

Parameters

  • value : String

    The value

    +

Returns

  • Boolean   

    true if the RegExp test passed, and false if not.

    +
 
email( +String value) + : Boolean
The function used to validate email addresses. Note that this is a very basic validation -- complete +validation per ...

The function used to validate email addresses. Note that this is a very basic validation -- complete +validation per the email RFC specifications is very complex and beyond the scope of this class, although +this function can be overridden if a more comprehensive validation scheme is desired. See the validation +section of the Wikipedia article on email addresses +for additional information. This implementation is intended to validate the following emails: +'barney@example.de', 'barney.rubble@example.com', 'barney-rubble@example.coop', 'barney+rubble@example.com' +.

+

Parameters

  • value : String

    The email address

    +

Returns

  • Boolean   

    true if the RegExp test passed, and false if not.

    +
 
url( +String value) + : Boolean

The function used to validate URLs

+

The function used to validate URLs

+

Parameters

  • value : String

    The URL

    +

Returns

  • Boolean   

    true if the RegExp test passed, and false if not.

    +
\ No newline at end of file