<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Validation Gotcha in CakePHP 1.2</title>
	<atom:link href="http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/feed/" rel="self" type="application/rss+xml" />
	<link>http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/</link>
	<description>My forays into the Kitchen</description>
	<lastBuildDate>Wed, 04 Nov 2009 22:02:31 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: 自転車で通勤しましょ♪ブログ - CakePHP1.2 Model::validates($data)の罠</title>
		<link>http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/#comment-2196</link>
		<dc:creator>自転車で通勤しましょ♪ブログ - CakePHP1.2 Model::validates($data)の罠</dc:creator>
		<pubDate>Tue, 03 Feb 2009 11:25:50 +0000</pubDate>
		<guid isPermaLink="false">http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/#comment-2196</guid>
		<description>[...] 注意：英語のサイトです。 http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/ [...]</description>
		<content:encoded><![CDATA[<p>[...] 注意：英語のサイトです。 <a href="http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/" rel="nofollow">http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 24 de noviembre de 2008. De CakePHP 1.1 a CakePHP 1.2. El baile de los errores. Parte IV &#171; Tutorial CakePHP informal, sobre la marcha. ¡Participa!</title>
		<link>http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/#comment-2062</link>
		<dc:creator>24 de noviembre de 2008. De CakePHP 1.1 a CakePHP 1.2. El baile de los errores. Parte IV &#171; Tutorial CakePHP informal, sobre la marcha. ¡Participa!</dc:creator>
		<pubDate>Mon, 24 Nov 2008 15:06:33 +0000</pubDate>
		<guid isPermaLink="false">http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/#comment-2062</guid>
		<description>[...] Por otra parte, el uso del método validates de la clase Model, que comprueba si los campos de un registro satisfacen las reglas de validación que se definen en el modelo, también ha cambiado. Esto lo explican aquí.  [...]</description>
		<content:encoded><![CDATA[<p>[...] Por otra parte, el uso del método validates de la clase Model, que comprueba si los campos de un registro satisfacen las reglas de validación que se definen en el modelo, también ha cambiado. Esto lo explican aquí.  [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mark</title>
		<link>http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/#comment-2010</link>
		<dc:creator>mark</dc:creator>
		<pubDate>Tue, 22 Jul 2008 01:02:54 +0000</pubDate>
		<guid isPermaLink="false">http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/#comment-2010</guid>
		<description>how can i validate a contact form?
i have a model Contact - but no Database
so i just put in the model  var $useTable = false;

but with the above code, it always shows validation errors - no matter if i typed something in or not in the contact form:

model Contact:
&lt;code&gt;	var $validate = array(
		&#039;name&#039; =&gt; array(
    		&#039;empty&#039; =&gt; array(
                  &#039;allowEmpty&#039; =&gt; false,
                  &#039;required&#039; =&gt; true,
                  &#039;message&#039; =&gt; &#039;Please insert your name&#039;,
                  )
               ),
		&#039;email&#039; =&gt; array(
        	&#039;required&#039; =&gt; array(
                  &#039;required&#039; =&gt; true,
                  &#039;message&#039; =&gt; &#039;Please insert your email&#039;,
                  )
               ),
		&#039;title&#039; =&gt; array(
        	&#039;alphanumeric&#039; =&gt; array(
                  &#039;allowEmpty&#039; =&gt; false,
                  &#039;message&#039; =&gt; &#039;Please insert title&#039;,
                  )
               )			               
	);&lt;/code&gt;

Controller Contact:
&lt;code&gt;	var $name = &#039;Contact&#039;;
	var $helpers = array(&#039;Html&#039;, &#039;Form&#039;);
	var $components = array(&#039;Email&#039;);
	
	function index() {
		
		if (!empty($this-&gt;data))
        {
        	$this-&gt;Contact-&gt;set($this-&gt;data); 
			if ($this-&gt;Contact-&gt;validates())
			{
				echo &#039;done&#039;;
			}        &lt;/code&gt;

View Index
&lt;code&gt;
Contact me:

create(&#039;Contact&#039;,array(&#039;controller&#039;=&gt;&#039;contact&#039;,&#039;action&#039;=&gt;&#039;index&#039;));?&gt;
	
 		
	input(&#039;name&#039;);
		echo $form-&gt;input(&#039;email&#039;);
		echo $form-&gt;input(&#039;title&#039;);
		echo $form-&gt;input(&#039;message&#039;,array(&#039;type&#039;=&gt;&#039;textfield&#039;));
		echo $form-&gt;input(&#039;attachments&#039;);
	?&gt;
	
end(&#039;Submit&#039;);?&gt;
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>how can i validate a contact form?<br />
i have a model Contact &#8211; but no Database<br />
so i just put in the model  var $useTable = false;</p>
<p>but with the above code, it always shows validation errors &#8211; no matter if i typed something in or not in the contact form:</p>
<p>model Contact:<br />
<code>	var $validate = array(<br />
		'name' =&gt; array(<br />
    		'empty' =&gt; array(<br />
                  'allowEmpty' =&gt; false,<br />
                  'required' =&gt; true,<br />
                  'message' =&gt; 'Please insert your name',<br />
                  )<br />
               ),<br />
		'email' =&gt; array(<br />
        	'required' =&gt; array(<br />
                  'required' =&gt; true,<br />
                  'message' =&gt; 'Please insert your email',<br />
                  )<br />
               ),<br />
		'title' =&gt; array(<br />
        	'alphanumeric' =&gt; array(<br />
                  'allowEmpty' =&gt; false,<br />
                  'message' =&gt; 'Please insert title',<br />
                  )<br />
               )<br />
	);</code></p>
<p>Controller Contact:<br />
<code>	var $name = 'Contact';<br />
	var $helpers = array('Html', 'Form');<br />
	var $components = array('Email');</p>
<p>	function index() {</p>
<p>		if (!empty($this-&gt;data))<br />
        {<br />
        	$this-&gt;Contact-&gt;set($this-&gt;data);<br />
			if ($this-&gt;Contact-&gt;validates())<br />
			{<br />
				echo 'done';<br />
			}        </code></p>
<p>View Index<br />
<code><br />
Contact me:</p>
<p>create('Contact',array('controller'=&gt;'contact','action'=&gt;'index'));?&gt;</p>
<p>	input('name');<br />
		echo $form-&gt;input('email');<br />
		echo $form-&gt;input('title');<br />
		echo $form-&gt;input('message',array('type'=&gt;'textfield'));<br />
		echo $form-&gt;input('attachments');<br />
	?&gt;</p>
<p>end('Submit');?&gt;<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/#comment-1999</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Tue, 15 Jul 2008 15:05:18 +0000</pubDate>
		<guid isPermaLink="false">http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/#comment-1999</guid>
		<description>Wow. Huge thanks. Definitely just spent about an hour stuck on this.</description>
		<content:encoded><![CDATA[<p>Wow. Huge thanks. Definitely just spent about an hour stuck on this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: George</title>
		<link>http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/#comment-1924</link>
		<dc:creator>George</dc:creator>
		<pubDate>Sun, 02 Mar 2008 17:04:54 +0000</pubDate>
		<guid isPermaLink="false">http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/#comment-1924</guid>
		<description>Geoff, thanks!

This saved me from giving cake the boot. Tired of the deprecated stuff and lack of docs.</description>
		<content:encoded><![CDATA[<p>Geoff, thanks!</p>
<p>This saved me from giving cake the boot. Tired of the deprecated stuff and lack of docs.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivo</title>
		<link>http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/#comment-565</link>
		<dc:creator>Ivo</dc:creator>
		<pubDate>Fri, 16 Nov 2007 00:23:25 +0000</pubDate>
		<guid isPermaLink="false">http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/#comment-565</guid>
		<description>Wow, I have looked for this answer all evening. Thanks for posting!</description>
		<content:encoded><![CDATA[<p>Wow, I have looked for this answer all evening. Thanks for posting!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen</title>
		<link>http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/#comment-361</link>
		<dc:creator>Stephen</dc:creator>
		<pubDate>Thu, 20 Sep 2007 05:17:20 +0000</pubDate>
		<guid isPermaLink="false">http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/#comment-361</guid>
		<description>Thanks for this post Geoff - saved me a lot of head scratching!</description>
		<content:encoded><![CDATA[<p>Thanks for this post Geoff &#8211; saved me a lot of head scratching!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Geoff</title>
		<link>http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/#comment-16</link>
		<dc:creator>Geoff</dc:creator>
		<pubDate>Tue, 26 Jun 2007 12:57:36 +0000</pubDate>
		<guid isPermaLink="false">http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/#comment-16</guid>
		<description>Thanks nate, I have updated the post to reflect your recommendation.</description>
		<content:encoded><![CDATA[<p>Thanks nate, I have updated the post to reflect your recommendation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nate</title>
		<link>http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/#comment-15</link>
		<dc:creator>nate</dc:creator>
		<pubDate>Tue, 26 Jun 2007 12:02:48 +0000</pubDate>
		<guid isPermaLink="false">http://lemoncake.wordpress.com/2007/06/26/validation-gotcha-in-cakephp-12/#comment-15</guid>
		<description>Direct manipulation of the Model&#039;s $data property is not recommended.  Use the set() method.</description>
		<content:encoded><![CDATA[<p>Direct manipulation of the Model&#8217;s $data property is not recommended.  Use the set() method.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
