<?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: Conditional Form Validation with Zend_Form</title>
	<atom:link href="http://www.jeremykendall.net/2008/12/24/conditional-form-validation-with-zend_form/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jeremykendall.net/2008/12/24/conditional-form-validation-with-zend_form/</link>
	<description>{web developer, entrepreneur }</description>
	<lastBuildDate>Thu, 05 Jan 2012 07:01:41 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Ishmael Vinas</title>
		<link>http://www.jeremykendall.net/2008/12/24/conditional-form-validation-with-zend_form/comment-page-1/#comment-646</link>
		<dc:creator>Ishmael Vinas</dc:creator>
		<pubDate>Mon, 12 Dec 2011 19:21:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeremykendall.net/?p=128#comment-646</guid>
		<description>hey sir!!!! thank you so much for this... ill be using this for my thesis..... thank you so much!!!!

God Bless you and your Family.... :) :) :)</description>
		<content:encoded><![CDATA[<p>hey sir!!!! thank you so much for this&#8230; ill be using this for my thesis&#8230;.. thank you so much!!!!</p>
<p>God Bless you and your Family&#8230;. <img src='http://www.jeremykendall.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  <img src='http://www.jeremykendall.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  <img src='http://www.jeremykendall.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: arasu</title>
		<link>http://www.jeremykendall.net/2008/12/24/conditional-form-validation-with-zend_form/comment-page-1/#comment-643</link>
		<dc:creator>arasu</dc:creator>
		<pubDate>Thu, 17 Nov 2011 09:24:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeremykendall.net/?p=128#comment-643</guid>
		<description>Great Script.
Thanks,
I have a new scenario, &quot;multiple validation with dependency&quot; 

         say if i have 2 text inputs both are dependent on each other,

i.e 
1. text box = user name
2. text box = email id
 
          if name is entered then email is mandatory and also to be checked is valid email id and valid name(only alphabets)?

the vice versa of this i.e if email id is entered then name is mandatory and also to be checked is valid name(only alphabets) and is valid email id?


can you help me out how to achieve this?

Thanks</description>
		<content:encoded><![CDATA[<p>Great Script.<br />
Thanks,<br />
I have a new scenario, &#8220;multiple validation with dependency&#8221; </p>
<p>         say if i have 2 text inputs both are dependent on each other,</p>
<p>i.e<br />
1. text box = user name<br />
2. text box = email id</p>
<p>          if name is entered then email is mandatory and also to be checked is valid email id and valid name(only alphabets)?</p>
<p>the vice versa of this i.e if email id is entered then name is mandatory and also to be checked is valid name(only alphabets) and is valid email id?</p>
<p>can you help me out how to achieve this?</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zend_form feltételes validáció &#124; Kerek egy ég alatt</title>
		<link>http://www.jeremykendall.net/2008/12/24/conditional-form-validation-with-zend_form/comment-page-1/#comment-641</link>
		<dc:creator>Zend_form feltételes validáció &#124; Kerek egy ég alatt</dc:creator>
		<pubDate>Thu, 03 Nov 2011 22:50:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeremykendall.net/?p=128#comment-641</guid>
		<description>[...] Conditional Form Validation with Zend_Form       Kategória: Zend Framework &#124; A közvetlen link.    &#8592; Elemek megjelenítése egyenként a Zend ?rlapon, Hiba üzenetek megjelenítése [...]</description>
		<content:encoded><![CDATA[<p>[...] Conditional Form Validation with Zend_Form       Kategória: Zend Framework | A közvetlen link.    &larr; Elemek megjelenítése egyenként a Zend ?rlapon, Hiba üzenetek megjelenítése [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Judye</title>
		<link>http://www.jeremykendall.net/2008/12/24/conditional-form-validation-with-zend_form/comment-page-1/#comment-631</link>
		<dc:creator>Judye</dc:creator>
		<pubDate>Sun, 31 Jul 2011 20:10:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeremykendall.net/?p=128#comment-631</guid>
		<description>Usually I do not read article on blogs, but I would like to say that this write-up very forced me to try and do it! Your writing style has been amazed me. Thanks, quite nice post.</description>
		<content:encoded><![CDATA[<p>Usually I do not read article on blogs, but I would like to say that this write-up very forced me to try and do it! Your writing style has been amazed me. Thanks, quite nice post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adamquadmon</title>
		<link>http://www.jeremykendall.net/2008/12/24/conditional-form-validation-with-zend_form/comment-page-1/#comment-428</link>
		<dc:creator>Adamquadmon</dc:creator>
		<pubDate>Mon, 15 Feb 2010 14:41:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeremykendall.net/?p=128#comment-428</guid>
		<description>after a lot of tries I give up with this validator and simple put in the preValidation() method:

if ($data[&#039;datatype&#039;] == &#039;radio&#039;) {
	$this-&gt;option_1-&gt;setRequired(true);
}

where datatype is my parent field and radio is the value that need the check if child option_1 field value is not empty.

What do you think about?</description>
		<content:encoded><![CDATA[<p>after a lot of tries I give up with this validator and simple put in the preValidation() method:</p>
<p>if ($data['datatype'] == &#8216;radio&#8217;) {<br />
	$this-&gt;option_1-&gt;setRequired(true);<br />
}</p>
<p>where datatype is my parent field and radio is the value that need the check if child option_1 field value is not empty.</p>
<p>What do you think about?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeremy</title>
		<link>http://www.jeremykendall.net/2008/12/24/conditional-form-validation-with-zend_form/comment-page-1/#comment-277</link>
		<dc:creator>jeremy</dc:creator>
		<pubDate>Fri, 15 Jan 2010 11:41:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeremykendall.net/?p=128#comment-277</guid>
		<description>Yeah, that allowEmpty can be a bear.  Glad to hear it&#039;s working for you.</description>
		<content:encoded><![CDATA[<p>Yeah, that allowEmpty can be a bear.  Glad to hear it&#8217;s working for you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil</title>
		<link>http://www.jeremykendall.net/2008/12/24/conditional-form-validation-with-zend_form/comment-page-1/#comment-276</link>
		<dc:creator>Neil</dc:creator>
		<pubDate>Fri, 15 Jan 2010 08:49:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeremykendall.net/?p=128#comment-276</guid>
		<description>Great Script.
Thanks
Had a bit of trouble with it at first as I hadn&#039;t read the write up properly and missed the bit about setting the allowEmpty flag on the validated element.  Very simple to use once this is in place.</description>
		<content:encoded><![CDATA[<p>Great Script.<br />
Thanks<br />
Had a bit of trouble with it at first as I hadn&#8217;t read the write up properly and missed the bit about setting the allowEmpty flag on the validated element.  Very simple to use once this is in place.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: omar</title>
		<link>http://www.jeremykendall.net/2008/12/24/conditional-form-validation-with-zend_form/comment-page-1/#comment-102</link>
		<dc:creator>omar</dc:creator>
		<pubDate>Tue, 13 Oct 2009 14:36:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeremykendall.net/?p=128#comment-102</guid>
		<description>The problem i had was that my custom validator was not being called when the value of the input (select) was empty. I couldnt use setRequired() because in some cases (dependent upon another form value) i want to process empty values.
The solution was to do the following:

$organiser_member = new Zend_Form_Element_Text(&#039;organiser_member&#039;);
$organiser_member-&gt;setLabel(&#039;* Organiser:&#039;);
	        
// Force empty values through the custom validator!
$organiser_member-&gt;setRequired(false);
$organiser_member-&gt;setAllowEmpty(false);

// Add the custom validator
$organiser_member-&gt;addPrefixPath(&#039;BC_Validate&#039;, &#039;BC/Validate&#039;, &#039;validate&#039;);
$organiser_member-&gt;addValidator(&#039;EventOrganiser&#039;, false);
$form-&gt;addElement($organiser_member);

Now the custom validator is always called, whether the input &#039;organiser_member&#039; is set or not.</description>
		<content:encoded><![CDATA[<p>The problem i had was that my custom validator was not being called when the value of the input (select) was empty. I couldnt use setRequired() because in some cases (dependent upon another form value) i want to process empty values.<br />
The solution was to do the following:</p>
<p>$organiser_member = new Zend_Form_Element_Text(&#8216;organiser_member&#8217;);<br />
$organiser_member-&gt;setLabel(&#8216;* Organiser:&#8217;);</p>
<p>// Force empty values through the custom validator!<br />
$organiser_member-&gt;setRequired(false);<br />
$organiser_member-&gt;setAllowEmpty(false);</p>
<p>// Add the custom validator<br />
$organiser_member-&gt;addPrefixPath(&#8216;BC_Validate&#8217;, &#8216;BC/Validate&#8217;, &#8216;validate&#8217;);<br />
$organiser_member-&gt;addValidator(&#8216;EventOrganiser&#8217;, false);<br />
$form-&gt;addElement($organiser_member);</p>
<p>Now the custom validator is always called, whether the input &#8216;organiser_member&#8217; is set or not.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://www.jeremykendall.net/2008/12/24/conditional-form-validation-with-zend_form/comment-page-1/#comment-100</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Mon, 14 Sep 2009 21:57:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeremykendall.net/?p=128#comment-100</guid>
		<description>Another way to solve this problem is oveload method Zend_Form::isValid for example:
public function isValid($data)
    {
        // First validation
        $result = parent::isValid($data);
        
        // Add optional second validator if first pass form is ok
        if ($result == true and $this-&gt;getValue(&#039;type&#039;)==&#039;MEM&#039;) {
            $element = $this-&gt;getElement(&#039;type&#039;);
            $element-&gt;addValidator(new Zend_Validate_Date());
            $result = parent::isValid($data);
        }
        
        return $result;
    }</description>
		<content:encoded><![CDATA[<p>Another way to solve this problem is oveload method Zend_Form::isValid for example:<br />
public function isValid($data)<br />
    {<br />
        // First validation<br />
        $result = parent::isValid($data);</p>
<p>        // Add optional second validator if first pass form is ok<br />
        if ($result == true and $this-&gt;getValue(&#8216;type&#8217;)==&#8217;MEM&#8217;) {<br />
            $element = $this-&gt;getElement(&#8216;type&#8217;);<br />
            $element-&gt;addValidator(new Zend_Validate_Date());<br />
            $result = parent::isValid($data);<br />
        }</p>
<p>        return $result;<br />
    }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil</title>
		<link>http://www.jeremykendall.net/2008/12/24/conditional-form-validation-with-zend_form/comment-page-1/#comment-98</link>
		<dc:creator>Phil</dc:creator>
		<pubDate>Tue, 21 Jul 2009 23:01:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeremykendall.net/?p=128#comment-98</guid>
		<description>I want something exactly like this, but I don&#039;t think I&#039;ll be able to use yours. It seems to implement the letter of Zend_Validate_Interface, but not the spirit. ZVI requires the function isValid($value). You implemented that with isValid($value, $context=null). It technically implements the interface, but whenever you call that function with a null context, it errors out. So you can&#039;t use this with something like Zend_Filter_Input that hides the isValid call from you.</description>
		<content:encoded><![CDATA[<p>I want something exactly like this, but I don&#8217;t think I&#8217;ll be able to use yours. It seems to implement the letter of Zend_Validate_Interface, but not the spirit. ZVI requires the function isValid($value). You implemented that with isValid($value, $context=null). It technically implements the interface, but whenever you call that function with a null context, it errors out. So you can&#8217;t use this with something like Zend_Filter_Input that hides the isValid call from you.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

