I think you can do the following:
if($this->Model->save($this->data) == true){
// successful save
// your success message
}
elsif($this->Model->save($this->data) == false){
// when things go wrong
$this->set('errors", $this->validateErrors($this->Model)));
}
validateErrors() displays validation errors messages.
You put this one on your controller function and you can do a print_r($errors) in the view file to get all the errors messages
Have a nice day.
I hope I have been useful.
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.On Wed, Dec 1, 2010 at 9:26 AM, Raisen <weyseal@gmail.com> wrote:
You can try to use a virtual field: http://book.cakephp.org/view/1608/Virtual-fields
Or you can validate those fields before you save and errors are found,
use the session flash variable to show the error message.
On Nov 29, 9:18 am, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> I am taking a single Model.phone and breaking the input up into 3 inputs
> (area_code) - (prefix) - (suffix) so my question is how do I validate that?
> I can merge the data to get my Model.phone and run standard validation on
> that but how to get the message on error back to the view since Model.phone
> is not on the page?
>
> My guess is validate each 3 if valid merge the data to get my Model.phone,
> but if any of the 3 are not valid (area_code) - (prefix) - (suffix) I only
> want 1 error message.
>
> I do not want individual error messages for the 3 inputs since everyone
> knows a phone number is NUMBER if they want to waste their time putting in
> letters and junk well then go ahead, I only want to return 1 error message
> for the full Model.phone (wrong length, not empty stuff like that
>
> Any ideas how to do this? Standard submit no js checking.
>
> Thanks,
>
> Dave
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment