Here's the way that worked for me: In your register() function replace the setFlash with
$this->User->invalidate('captcha','Incorrect captcha code entered'); Then in your view add <?php echo $form->error('User.captcha'); Remember to do a $this->render(); if you catch an error... Hope that helps. PS - this is my first post to this group, so please be gentle if there is a better way of doing this! On May 18, 2:43 am, Mike52 <[EMAIL PROTECTED]> wrote: > I have a problem setting the error text on a form field that is not > associated with the model. > > This is my situation: > I have a registration form that allows a user to submit his email > address. This form contains an input field for a captcha. The captcha > text is not part of the model. And nor should it be, in my option, as > it is controller logic. > > The controller validates the value of the captcha field. Currently, my > controller action looks like this: > > function register() { > if (!empty($this->data)) { > if ($this->data['User']['captcha'] != $_SESSION['captcha']) { > $this->Session->setFlash('Incorrect captcha code entered'); > $this->data['User']['captcha'] = ''; > return; > } > > This works, but it does not display an appropriate error text near the > captcha field. > How can I set the error message/status on this field? > > Thanks, > Mike --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---