Hi Paul,
You can also access the validation errors directly in the view, so you
could just have this in your controller...
$this->User->save($this->data);
and something like this in your view...
<?php
$response = array(
'success' => empty($this->validationErrors),
'errors' => $this->validationErrors
}
echo $javascript->object($response);
?>
Cheers,
Adam
On Dec 13, 6:50 pm, pkclarke <[email protected]> wrote:
> Hi Guys,
>
> It's OK, I found the "invalidFields()" function. Here's the
> implementation if your interested:
>
> if ($this->User->save($this->data)) {
> $this->set('success', '{success:true}');} else {
>
> $errors = $this->User->invalidFields();
> $this->set('success', '{success:false, errors:'.json_encode
> ($errors).'}');
>
> }
>
> Cheers Paul.
>
> On Dec 13, 7:20 pm, pkclarke <[email protected]> wrote:
>
> > I am trying to integrate CakePHP with ExtJS. What is the best way to
> > handle validation? How can I capture validation messages in the
> > Controller so that I can return them to the ExtJS form in JSON format?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---