<?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: Custom validators for Zend_Form_Element</title>
	<atom:link href="http://www.zendframeworkinaction.com/2008/04/18/custom-validators-for-zend_form_element/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zendframeworkinaction.com/2008/04/18/custom-validators-for-zend_form_element/</link>
	<description>A book about Zend Framework</description>
	<lastBuildDate>Fri, 05 Mar 2010 09:09:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: alidbc</title>
		<link>http://www.zendframeworkinaction.com/2008/04/18/custom-validators-for-zend_form_element/comment-page-1/#comment-177</link>
		<dc:creator>alidbc</dc:creator>
		<pubDate>Wed, 04 Jun 2008 21:47:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendframeworkinaction.com/?p=50#comment-177</guid>
		<description>&lt;p&gt;class ValidateValueRepeat extends Zend_Validate_Abstract
{
    const NOT_MATCH = &#039;notMatch&#039;;
    protected $_messageTemplates = array(self::NOT_MATCH =&gt; &#039;Value Does not match its repeated value&#039;);
    private $repeatedField;
    public function __construct($repeatedField){
        $this-&gt;repeatedField = $repeatedField;
    }&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;public function isValid($value, $context = null)
{
    $value = (string) $value;
    $this-&gt;_setValue($value);

    if (is_array($context)) {
        if (isset($context[&quot;$this-&gt;repeatedField&quot;])
            &amp;&amp; ($value == $context[&quot;$this-&gt;repeatedField&quot;]))
        {
            return true;
        }
    } elseif (is_string($context) &amp;&amp; ($value == $context)) {
        return true;
    }

    $this-&gt;_error(self::NOT_MATCH);
    return false;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;}&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>class ValidateValueRepeat extends Zend_Validate_Abstract
{
    const NOT_MATCH = &#8216;notMatch&#8217;;
    protected $_messageTemplates = array(self::NOT_MATCH =&gt; &#8216;Value Does not match its repeated value&#8217;);
    private $repeatedField;
    public function __construct($repeatedField){
        $this-&gt;repeatedField = $repeatedField;
    }</p>

<pre><code>public function isValid($value, $context = null)
{
    $value = (string) $value;
    $this-&gt;_setValue($value);

    if (is_array($context)) {
        if (isset($context["$this-&gt;repeatedField"])
            &amp;&amp; ($value == $context["$this-&gt;repeatedField"]))
        {
            return true;
        }
    } elseif (is_string($context) &amp;&amp; ($value == $context)) {
        return true;
    }

    $this-&gt;_error(self::NOT_MATCH);
    return false;
}
</code></pre>

<p>}</p>]]></content:encoded>
	</item>
	<item>
		<title>By: alidbc</title>
		<link>http://www.zendframeworkinaction.com/2008/04/18/custom-validators-for-zend_form_element/comment-page-1/#comment-176</link>
		<dc:creator>alidbc</dc:creator>
		<pubDate>Wed, 04 Jun 2008 21:45:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendframeworkinaction.com/?p=50#comment-176</guid>
		<description>&lt;p&gt;I think this is simpler and logical&lt;/p&gt;

&lt;p&gt; &#039;Value Does not match its repeated value&#039;);
    private $repeatedField;
    public function __construct($repeatedField){
        $this-&gt;repeatedField = $repeatedField;
    }&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;public function isValid($value, $context = null)
{
    $value = (string) $value;
    $this-&gt;_setValue($value);

    if (is_array($context)) {
        if (isset($context[&quot;$this-&gt;repeatedField&quot;])
            &amp;&amp; ($value == $context[&quot;$this-&gt;repeatedField&quot;]))
        {
            return true;
        }
    } elseif (is_string($context) &amp;&amp; ($value == $context)) {
        return true;
    }

    $this-&gt;_error(self::NOT_MATCH);
    return false;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;}&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I think this is simpler and logical</p>

<p> &#8216;Value Does not match its repeated value&#8217;);
    private $repeatedField;
    public function __construct($repeatedField){
        $this-&gt;repeatedField = $repeatedField;
    }</p>

<pre><code>public function isValid($value, $context = null)
{
    $value = (string) $value;
    $this-&gt;_setValue($value);

    if (is_array($context)) {
        if (isset($context["$this-&gt;repeatedField"])
            &amp;&amp; ($value == $context["$this-&gt;repeatedField"]))
        {
            return true;
        }
    } elseif (is_string($context) &amp;&amp; ($value == $context)) {
        return true;
    }

    $this-&gt;_error(self::NOT_MATCH);
    return false;
}
</code></pre>

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