I don't want to save data to database with just checking if data is
not empty. I want to validate entered data and display errors before
saving to database table.
As I wrote, in model I supply which fields I want to validate - I
supply rule for field and message which should be displayed if field
hasn't been filled out correctly.
In controller I use $this->User->set($this->data) and $this->User-
>validates() to check if supplied data is valid.
If it's not valid, I use $this->validateErrors($this->User) to display
error messages.
The problem is, $form->error('field') doesn't display error message
from $validate variable. Validation function creates the div "error-
message" for message, but the div is empty.
If I use $form->error('field','Some message') - message is displayed.
But I don't want to enter messages text in the view. I rather keep
that in user.php model in $validate variable. But this way, message is
not displayed and I don't know why.
I even changed the version of CakePHP from 1.2.6 to 1.2.5, but it
still doesn't show error messages, which is really weird, cause I use
this solution in every project and in every project on 1.2.5 it always
worked.
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
No comments:
Post a Comment