<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blue Horn &#187; symfony 1.1</title>
	<atom:link href="http://bluehorn.co.nz/tag/symfony-11/feed/" rel="self" type="application/rss+xml" />
	<link>http://bluehorn.co.nz</link>
	<description>New Zealand Web Design &#38; Development (PHP 5, MySQL, Symfony Framework, Apache, Linux)</description>
	<lastBuildDate>Tue, 29 Nov 2011 22:23:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>How to add a captcha field in Symfony 1.1</title>
		<link>http://bluehorn.co.nz/2009/02/05/how-to-add-a-captcha-field-in-symfony-11/</link>
		<comments>http://bluehorn.co.nz/2009/02/05/how-to-add-a-captcha-field-in-symfony-11/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 11:41:22 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[Symfony Framework]]></category>
		<category><![CDATA[captcha]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[symfony 1.1]]></category>

		<guid isPermaLink="false">http://bluehorn.co.nz/?p=180</guid>
		<description><![CDATA[Step by step on how to add a captcha field to a Symfony 1.1 form. 1. Install sfFormExtraPlugin: $ symfony plugin:install sfFormExtraPlugin $ symfony cache:clear 2. Register for public and private keys at recaptcha.net. It's free! Note that when you're creating keys, it's better to tick the 'Enable this key on all domains (global key)'. [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Step by step on how to add a captcha field to a Symfony 1.1 form.</p>
<p><span id="more-180"></span></p>
<p><strong>1.</strong> Install <a href="http://www.symfony-project.org/plugins/sfFormExtraPlugin" target="_blank">sfFormExtraPlugin</a>:<a href="http://www.symfony-project.org/plugins/sfFormExtraPlugin" target="_blank"><br />
</a></p>
<blockquote><p>$ symfony plugin:install sfFormExtraPlugin<br />
$ symfony cache:clear</p></blockquote>
<p><strong>2.</strong> Register for public and private keys at <a href="http://recaptcha.net" target="_blank">recaptcha.net</a>. It's free! Note that when you're creating keys, it's better to tick the 'Enable this key on all domains (global key)'. This will allow you to use it anywhere. But of course it would be a good idea to untick this once your website goes live.</p>
<p><strong>3.</strong> Add the captcha widget and validator to your form class:</p>
<blockquote><p>// widget:<br />
'captcha' =&gt; new sfWidgetFormReCaptcha(array('public_key' =&gt; 'your public key here'))<br />
// validator:<br />
'captcha' =&gt; new sfValidatorReCaptcha(array('private_key' =&gt; 'your private key here'))</p></blockquote>
<p><strong>4.</strong> And lastly, the way you bind the form values is quite different now. Instead of:</p>
<blockquote><p>$form-&gt;bind($values);</p></blockquote>
<p>with the captcha, now you have to do:</p>
<blockquote><p>$captcha = array(<br />
'recaptcha_challenge_field' =&gt; $request-&gt;getParameter('recaptcha_challenge_field'),<br />
'recaptcha_response_field'  =&gt; $request-&gt;getParameter('recaptcha_response_field'),<br />
);<br />
$form-&gt;bind(array_merge($values, array('captcha' =&gt; $captcha)));</p></blockquote>
<p><strong>That's it! :-)</strong></p>
<p>These information are kind of available in sfWidgetFormReCaptcha.class.php and sfValidatorReCaptcha.class.php, so I would recommend go and look there too.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://bluehorn.co.nz/2009/02/05/how-to-add-a-captcha-field-in-symfony-11/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

