Try manually setting the error:

$this->User->validationErrors['captcha'] = 'not so fast, buddy';

I believe this is how i did it. I'm on my first cup of coffee and
can't remember which controller that was in, though (or if it even
worked ;-)

On Sun, May 18, 2008 at 3: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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to