<?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"
	>
<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 the Zend Framework</description>
	<pubDate>Wed, 20 Aug 2008 07:01:52 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
		<item>
		<title>By: alidbc</title>
		<link>http://www.zendframeworkinaction.com/2008/04/18/custom-validators-for-zend_form_element/#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 = 'notMatch';
    protected $_messageTemplates = array(self::NOT_MATCH =&#62; 'Value Does not match its repeated value');
    private $repeatedField;
    public function __construct($repeatedField){
        $this-&#62;repeatedField = $repeatedField;
    }&lt;/p&gt;

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

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

    $this-&#62;_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-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; 'Value Does not match its repeated value');
    private $repeatedField;
    public function __construct($repeatedField){
        $this-&#62;repeatedField = $repeatedField;
    }&lt;/p&gt;

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

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

    $this-&#62;_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>
