Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / docs / source / VTypes.html
index 01d2579..f0967b1 100644 (file)
-<html>
-<head>
-  <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>
-</head>
-<body  onload="prettyPrint();">
-    <pre class="prettyprint lang-js">/*!
- * Ext JS Library 3.3.1
- * Copyright(c) 2006-2010 Sencha Inc.
- * licensing@sencha.com
- * http://www.sencha.com/license
- */
-<div id="cls-Ext.form.VTypes"></div>/**
- * @class Ext.form.VTypes
- * <p>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.</p>
- * <p>To add custom VTypes specify the <code>{@link Ext.form.TextField#vtype vtype}</code> validation
+<!DOCTYPE html><html><head><title>Sencha Documentation Project</title><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../prettify.css" type="text/css"><link rel="stylesheet" href="../prettify_sa.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script></head><body onload="prettyPrint()"><pre class="prettyprint"><pre><span id='Ext-form.field.VTypes'>/**
+</span> * @class Ext.form.field.VTypes
+ * &lt;p&gt;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.&lt;/p&gt;
+ * &lt;p&gt;To add custom VTypes specify the &lt;code&gt;{@link Ext.form.field.Text#vtype vtype}&lt;/code&gt; validation
  * test function, and optionally specify any corresponding error text to display and any keystroke
- * filtering mask to apply. For example:</p>
- * <pre><code>
+ * filtering mask to apply. For example:&lt;/p&gt;
+ * &lt;pre&gt;&lt;code&gt;
 // 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.VTypes, {
+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".',
+    timeText: 'Not a valid time.  Must be in the format &quot;12:34 PM&quot;.',
     // vtype Mask property: The keystroke filter mask
     timeMask: /[\d\s:amp]/i
 });
- * </code></pre>
+ * &lt;/code&gt;&lt;/pre&gt;
  * Another example:
- * <pre><code>
+ * &lt;pre&gt;&lt;code&gt;
 // custom Vtype for vtype:'IPAddress'
-Ext.apply(Ext.form.VTypes, {
+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
 });
- * </code></pre>
+ * &lt;/code&gt;&lt;/pre&gt;
  * @singleton
  */
-Ext.form.VTypes = function(){
+Ext.define('Ext.form.field.VTypes', (function(){
     // closure these in so they are only created once.
     var alpha = /^[a-zA-Z_]+$/,
         alphanum = /^[a-zA-Z0-9_]+$/,
         email = /^(\w+)([\-+.][\w]+)*@(\w[\-\w]*\.){1,5}([A-Za-z]){2,6}$/,
-        url = /(((^https?)|(^ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;
+        url = /(((^https?)|(^ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&amp;#;`~=%!]*)(\.\w{2,})?)*\/?)/i;
 
     // All these messages and functions are configurable
     return {
-        <div id="method-Ext.form.VTypes-email"></div>/**
-         * The function used to validate email addresses.  Note that this is a very basic validation -- complete
+        singleton: true,
+        alternateClassName: 'Ext.form.VTypes',
+
+<span id='Ext-form.field.VTypes-method-email'>        /**
+</span>         * 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 <a href="http://en.wikipedia.org/wiki/E-mail_address">Wikipedia article on email addresses</a>
-         * for additional information.  This implementation is intended to validate the following emails:<tt>
+         * section of the &lt;a href=&quot;http://en.wikipedia.org/wiki/E-mail_address&quot;&gt;Wikipedia article on email addresses&lt;/a&gt;
+         * for additional information.  This implementation is intended to validate the following emails:&lt;tt&gt;
          * 'barney@example.de', 'barney.rubble@example.com', 'barney-rubble@example.coop', 'barney+rubble@example.com'
-         * </tt>.
+         * &lt;/tt&gt;.
          * @param {String} value The email address
          * @return {Boolean} true if the RegExp test passed, and false if not.
          */
         'email' : function(v){
             return email.test(v);
         },
-        <div id="prop-Ext.form.VTypes-emailText"></div>/**
-         * The error text to display when the email validation function returns false.  Defaults to:
-         * <tt>'This field should be an e-mail address in the format "user@example.com"'</tt>
+<span id='Ext-form.field.VTypes-property-emailText'>        /**
+</span>         * The error text to display when the email validation function returns false.  Defaults to:
+         * &lt;tt&gt;'This field should be an e-mail address in the format &quot;user@example.com&quot;'&lt;/tt&gt;
          * @type String
          */
-        'emailText' : 'This field should be an e-mail address in the format "user@example.com"',
-        <div id="prop-Ext.form.VTypes-emailMask"></div>/**
-         * The keystroke filter mask to be applied on email input.  See the {@link #email} method for
+        'emailText' : 'This field should be an e-mail address in the format &quot;user@example.com&quot;',
+<span id='Ext-form.field.VTypes-property-emailMask'>        /**
+</span>         * The keystroke filter mask to be applied on email input.  See the {@link #email} method for
          * information about more complex email validation. Defaults to:
-         * <tt>/[a-z0-9_\.\-@]/i</tt>
+         * &lt;tt&gt;/[a-z0-9_\.\-@]/i&lt;/tt&gt;
          * @type RegExp
          */
         'emailMask' : /[a-z0-9_\.\-@\+]/i,
 
-        <div id="method-Ext.form.VTypes-url"></div>/**
-         * The function used to validate URLs
+<span id='Ext-form.field.VTypes-method-url'>        /**
+</span>         * The function used to validate URLs
          * @param {String} value The URL
          * @return {Boolean} true if the RegExp test passed, and false if not.
          */
         'url' : function(v){
             return url.test(v);
         },
-        <div id="prop-Ext.form.VTypes-urlText"></div>/**
-         * The error text to display when the url validation function returns false.  Defaults to:
-         * <tt>'This field should be a URL in the format "http:/'+'/www.example.com"'</tt>
+<span id='Ext-form.field.VTypes-property-urlText'>        /**
+</span>         * The error text to display when the url validation function returns false.  Defaults to:
+         * &lt;tt&gt;'This field should be a URL in the format &quot;http:/'+'/www.example.com&quot;'&lt;/tt&gt;
          * @type String
          */
-        'urlText' : 'This field should be a URL in the format "http:/'+'/www.example.com"',
+        'urlText' : 'This field should be a URL in the format &quot;http:/'+'/www.example.com&quot;',
 
-        <div id="method-Ext.form.VTypes-alpha"></div>/**
-         * The function used to validate alpha values
+<span id='Ext-form.field.VTypes-method-alpha'>        /**
+</span>         * The function used to validate alpha values
          * @param {String} value The value
          * @return {Boolean} true if the RegExp test passed, and false if not.
          */
         'alpha' : function(v){
             return alpha.test(v);
         },
-        <div id="prop-Ext.form.VTypes-alphaText"></div>/**
-         * The error text to display when the alpha validation function returns false.  Defaults to:
-         * <tt>'This field should only contain letters and _'</tt>
+<span id='Ext-form.field.VTypes-property-alphaText'>        /**
+</span>         * The error text to display when the alpha validation function returns false.  Defaults to:
+         * &lt;tt&gt;'This field should only contain letters and _'&lt;/tt&gt;
          * @type String
          */
         'alphaText' : 'This field should only contain letters and _',
-        <div id="prop-Ext.form.VTypes-alphaMask"></div>/**
-         * The keystroke filter mask to be applied on alpha input.  Defaults to:
-         * <tt>/[a-z_]/i</tt>
+<span id='Ext-form.field.VTypes-property-alphaMask'>        /**
+</span>         * The keystroke filter mask to be applied on alpha input.  Defaults to:
+         * &lt;tt&gt;/[a-z_]/i&lt;/tt&gt;
          * @type RegExp
          */
         'alphaMask' : /[a-z_]/i,
 
-        <div id="method-Ext.form.VTypes-alphanum"></div>/**
-         * The function used to validate alphanumeric values
+<span id='Ext-form.field.VTypes-method-alphanum'>        /**
+</span>         * The function used to validate alphanumeric values
          * @param {String} value The value
          * @return {Boolean} true if the RegExp test passed, and false if not.
          */
         'alphanum' : function(v){
             return alphanum.test(v);
         },
-        <div id="prop-Ext.form.VTypes-alphanumText"></div>/**
-         * The error text to display when the alphanumeric validation function returns false.  Defaults to:
-         * <tt>'This field should only contain letters, numbers and _'</tt>
+<span id='Ext-form.field.VTypes-property-alphanumText'>        /**
+</span>         * The error text to display when the alphanumeric validation function returns false.  Defaults to:
+         * &lt;tt&gt;'This field should only contain letters, numbers and _'&lt;/tt&gt;
          * @type String
          */
         'alphanumText' : 'This field should only contain letters, numbers and _',
-        <div id="prop-Ext.form.VTypes-alphanumMask"></div>/**
-         * The keystroke filter mask to be applied on alphanumeric input.  Defaults to:
-         * <tt>/[a-z0-9_]/i</tt>
+<span id='Ext-form.field.VTypes-property-alphanumMask'>        /**
+</span>         * The keystroke filter mask to be applied on alphanumeric input.  Defaults to:
+         * &lt;tt&gt;/[a-z0-9_]/i&lt;/tt&gt;
          * @type RegExp
          */
         'alphanumMask' : /[a-z0-9_]/i
     };
-}();
-</pre>    
-</body>
-</html>
\ No newline at end of file
+})());
+</pre></pre></body></html>
\ No newline at end of file