Stuart Posted November 15, 2012 Share Posted November 15, 2012 Hi, Not been on here in a while! Doing lots of Yii work though so should be able to start helping people out now the books out. Bought a copy last week - only had chance to browse and already looks like it explains concepts far better than the other Yii book I have! I want to render a form inside a modal window that is part of the main.php layout file. The form needs a CAPTCHA which is where my problems start. Adding a CAPTCHA directly to an action's view works fine but as soon as I try and do it from main.php I'm running into all kinds of problems. It seems unless I'm on the page the form points to I have to enter the CAPTCHA twice - some issue where the value must be getting set twice/overwritten? At the moment I've had to add the action and access filter to all of my controllers (which I know is disgusting) but I can't see how to make this work? Thanks Stuart Link to comment Share on other sites More sharing options...
Stuart Posted November 15, 2012 Author Share Posted November 15, 2012 After posting I decided to stop reading forums and the docs and jump into the source code. You simply have to set the captchaAction using a route: $this->widget('CCaptcha', array('captchaAction'=>'feedback/captcha')); This wasn't that apparent to me when reading the docs but the source code comments provide an explicit example. So now I can render the CAPTCHA widget in the main.php and it works great! Sorry for wasting people's time who read this... its been a long few days 2 Link to comment Share on other sites More sharing options...
Larry Posted November 16, 2012 Share Posted November 16, 2012 Yes, that's it. Kudos for figuring it out and thanks for sharing! Link to comment Share on other sites More sharing options...
Recommended Posts