<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Advanced Data Validation Using ExtJs</title>
	<atom:link href="http://blog.adampresley.com/2008/advanced-data-validation-using-extjs/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.adampresley.com/2008/advanced-data-validation-using-extjs/</link>
	<description>I&#039;m bringin&#039; nerdy back.</description>
	<lastBuildDate>Wed, 10 Mar 2010 04:10:48 -0600</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: TEHEK</title>
		<link>http://blog.adampresley.com/2008/advanced-data-validation-using-extjs/comment-page-1/#comment-7109</link>
		<dc:creator>TEHEK</dc:creator>
		<pubDate>Fri, 05 Feb 2010 21:00:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.adampresley.com/?p=169#comment-7109</guid>
		<description>&lt;p&gt;... The markup is screwed... well, here is updated code anyway:&lt;/p&gt;

&lt;p&gt;Ext.apply(Ext.form.VTypes, {
    match: function(value, field){
        if (field.matchField) {
            var form = field.findParentByType(&#039;form&#039;);
            var f;
            if (form &amp;&amp; form.getForm() &amp;&amp; (f = form.getForm().findField(field.matchField))) {
                if (value == f.getValue()){
                    f.clearInvalid();
                    return true;
                }
                // else
                if (field.matchInvalidText)
                    this.matchText = field.matchInvalidText;
                f.markInvalid(this.matchText);
            }
            return false;
        }&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;&lt;code&gt;    return (true);
},
matchText: &#039;Values do not match&#039;
&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;});&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>&#8230; The markup is screwed&#8230; well, here is updated code anyway:</p>

<p>Ext.apply(Ext.form.VTypes, {
    match: function(value, field){
        if (field.matchField) {
            var form = field.findParentByType(&#8216;form&#8217;);
            var f;
            if (form &amp;&amp; form.getForm() &amp;&amp; (f = form.getForm().findField(field.matchField))) {
                if (value == f.getValue()){
                    f.clearInvalid();
                    return true;
                }
                // else
                if (field.matchInvalidText)
                    this.matchText = field.matchInvalidText;
                f.markInvalid(this.matchText);
            }
            return false;
        }</p>

<p><pre><code>    return (true);
},
matchText: 'Values do not match'
</code></pre></p>

<p>});</p>]]></content:encoded>
	</item>
	<item>
		<title>By: TEHEK</title>
		<link>http://blog.adampresley.com/2008/advanced-data-validation-using-extjs/comment-page-1/#comment-7108</link>
		<dc:creator>TEHEK</dc:creator>
		<pubDate>Fri, 05 Feb 2010 20:47:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.adampresley.com/?p=169#comment-7108</guid>
		<description>&lt;p&gt;Hey guys, I&#039;ve found this one when I needed to check my password fields for matching.&lt;/p&gt;

&lt;p&gt;So I wrote similar to yours:&lt;/p&gt;

&lt;p&gt;[code]
Ext.apply(Ext.form.VTypes, {
    match: function(value, field){
        if (field.matchField) {
            var form = field.findParentByType(&#039;form&#039;);
            var f;
            if (form &amp;&amp; form.getForm() &amp;&amp; (f = form.getForm().findField(field.matchField))) {
                if (value == f.getValue())
                    return true;
                // else
                if (field.matchInvalidText)
                    this.matchText = field.matchInvalidText;
                f.markInvalid(this.matchText);
            }
            return false;
        }&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;&lt;code&gt;    return (true);
},
matchText: &#039;Values do not match&#039;
&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;});
[/code]&lt;/p&gt;

&lt;p&gt;Useage: 
[code]
{
    fieldLabel: &#039;New password&#039;,
    xtype:      &#039;textfield&#039;,
    anchor: &#039;100%&#039;,
    inputType:  &#039;password&#039;,
    name:       &#039;password&#039;,
    vtype:      &#039;match&#039;,
    matchField: &#039;password2&#039;,
    matchInvalidText:   &#039;Passwords do not match&#039;
},
{
    fieldLabel: &#039;Confirm password&#039;,
    xtype:      &#039;textfield&#039;,
    anchor: &#039;100%&#039;,
    inputType:  &#039;password&#039;,
    name:       &#039;password2&#039;,
    vtype:      &#039;match&#039;,
    matchField: &#039;password&#039;,
    matchInvalidText:   &#039;Passwords do not match&#039;
}
[/code]&lt;/p&gt;

&lt;p&gt;The benefit is:
* It doesn&#039;t require fields to have IDs (which is importaint if you may have many password fields at once). Both fields must be within the same FormPanel.
* customizable mismatch text.&lt;/p&gt;

&lt;p&gt;Cheerz ^_^&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hey guys, I&#8217;ve found this one when I needed to check my password fields for matching.</p>

<p>So I wrote similar to yours:</p>

<p>[code]
Ext.apply(Ext.form.VTypes, {
    match: function(value, field){
        if (field.matchField) {
            var form = field.findParentByType('form');
            var f;
            if (form &amp;&amp; form.getForm() &amp;&amp; (f = form.getForm().findField(field.matchField))) {
                if (value == f.getValue())
                    return true;
                // else
                if (field.matchInvalidText)
                    this.matchText = field.matchInvalidText;
                f.markInvalid(this.matchText);
            }
            return false;
        }</p>

<p><pre><code>    return (true);
},
matchText: 'Values do not match'
</code></pre></p>

<p>});
[/code]</p>

<p>Useage: 
[code]
{
    fieldLabel: 'New password',
    xtype:      'textfield',
    anchor: '100%',
    inputType:  'password',
    name:       'password',
    vtype:      'match',
    matchField: 'password2',
    matchInvalidText:   'Passwords do not match'
},
{
    fieldLabel: 'Confirm password',
    xtype:      'textfield',
    anchor: '100%',
    inputType:  'password',
    name:       'password2',
    vtype:      'match',
    matchField: 'password',
    matchInvalidText:   'Passwords do not match'
}
[/code]</p>

<p>The benefit is:
* It doesn&#8217;t require fields to have IDs (which is importaint if you may have many password fields at once). Both fields must be within the same FormPanel.
* customizable mismatch text.</p>

<p>Cheerz ^_^</p>]]></content:encoded>
	</item>
	<item>
		<title>By: psykoprogrammer</title>
		<link>http://blog.adampresley.com/2008/advanced-data-validation-using-extjs/comment-page-1/#comment-1949</link>
		<dc:creator>psykoprogrammer</dc:creator>
		<pubDate>Mon, 02 Mar 2009 20:15:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.adampresley.com/?p=169#comment-1949</guid>
		<description>&lt;p&gt;Thanks for pointing that out. Nice catch.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks for pointing that out. Nice catch.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: edykstra</title>
		<link>http://blog.adampresley.com/2008/advanced-data-validation-using-extjs/comment-page-1/#comment-1948</link>
		<dc:creator>edykstra</dc:creator>
		<pubDate>Sun, 01 Mar 2009 23:40:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.adampresley.com/?p=169#comment-1948</guid>
		<description>&lt;p&gt;Adam,&lt;/p&gt;

&lt;p&gt;This works better (but the regex needs to be added back in.)&lt;/p&gt;

&lt;p&gt;Ext.apply(Ext.form.VTypes, {
  password: function(value, field){
    var valid = false;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;if (field.matches){
  var otherField = Ext.getCmp(field.matches);

  if(value == otherField.getValue())
  {
    otherField.clearInvalid();
    valid = true;
  }
}

return valid;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;},&lt;/p&gt;

&lt;p&gt;passwordText: &#039;Passwords do not match.&#039;,
});&lt;/p&gt;

&lt;p&gt;With the following items:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;    fieldLabel:       &#039;Password&#039;,
    id:               &#039;password&#039;,
    name:             &#039;password&#039;,
    inputType:        &#039;password&#039;,
    allowBlank:       false,
    minLength:        5,
    minLengthText:    &#039;Must be between 5-20 characters&#039;,
    maxLength:        20,
    maxLengthText:    &#039;Must be between 5-20 characters&#039;,
    vtype:            &#039;password&#039;,
    matches:          &#039;password2&#039;
  },{
    fieldLabel:       &#039;Password (Confirm)&#039;,
    id:               &#039;password2&#039;,
    name:             &#039;password2&#039;,
    inputType:        &#039;password&#039;,
    allowBlank:       false,
    minLength:        5,
    minLengthText:    &#039;Must be between 5-20 characters&#039;,
    maxLength:        20,
    maxLengthText:    &#039;Must be between 5-20 characters&#039;,
    vtype:            &#039;password&#039;,
    matches:          &#039;password&#039;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Regards,&lt;/p&gt;

&lt;p&gt;Eric&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Adam,</p>

<p>This works better (but the regex needs to be added back in.)</p>

<p>Ext.apply(Ext.form.VTypes, {
  password: function(value, field){
    var valid = false;</p>

<pre><code>if (field.matches){
  var otherField = Ext.getCmp(field.matches);

  if(value == otherField.getValue())
  {
    otherField.clearInvalid();
    valid = true;
  }
}

return valid;
</code></pre>

<p>},</p>

<p>passwordText: &#8216;Passwords do not match.&#8217;,
});</p>

<p>With the following items:</p>

<pre><code>    fieldLabel:       'Password',
    id:               'password',
    name:             'password',
    inputType:        'password',
    allowBlank:       false,
    minLength:        5,
    minLengthText:    'Must be between 5-20 characters',
    maxLength:        20,
    maxLengthText:    'Must be between 5-20 characters',
    vtype:            'password',
    matches:          'password2'
  },{
    fieldLabel:       'Password (Confirm)',
    id:               'password2',
    name:             'password2',
    inputType:        'password',
    allowBlank:       false,
    minLength:        5,
    minLengthText:    'Must be between 5-20 characters',
    maxLength:        20,
    maxLengthText:    'Must be between 5-20 characters',
    vtype:            'password',
    matches:          'password'
</code></pre>

<p>Regards,</p>

<p>Eric</p>]]></content:encoded>
	</item>
	<item>
		<title>By: edykstra</title>
		<link>http://blog.adampresley.com/2008/advanced-data-validation-using-extjs/comment-page-1/#comment-1947</link>
		<dc:creator>edykstra</dc:creator>
		<pubDate>Sun, 01 Mar 2009 23:01:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.adampresley.com/?p=169#comment-1947</guid>
		<description>&lt;p&gt;Adam,&lt;/p&gt;

&lt;p&gt;In the above example, if the password is entered and then confirmed, and then the user goes back to the first to edit it, the validation fails to notice they no longer match.&lt;/p&gt;

&lt;p&gt;Eric&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Adam,</p>

<p>In the above example, if the password is entered and then confirmed, and then the user goes back to the first to edit it, the validation fails to notice they no longer match.</p>

<p>Eric</p>]]></content:encoded>
	</item>
</channel>
</rss>
