Hi,
I mean manually because Cake automatically validates data before
saving it when you call Model::save and if validation fails it will
not save it and sets the validation errors for the view.
http://book.cakephp.org/view/75/Saving-Your-Data
There is also no need to call your errors using
Hi,
If you want display any filed custom error place for specific field,
you can use
http://book.cakephp.org/view/198/options-error
http://book.cakephp.org/ro/compare/724/isFieldError
echo $form-input('email',array('error'=false));
at any place on the page use this to display error.
Hello. What do you mean by manually?
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
Why have you chose to do various parts of this process manually? By
doing so you simply increase the chances of human error IMO.
View:
echo $form-create('User');
echo $form-input('User.fname');
echo $form-input('User.lname');
echo $form-end('Submit');
Will submit to /users/add
Controller:
Hello all.
I have a problem with displaying error messages after form validation.
Model user.php:
var $validate = array(
'fname' = array(
'rule' = array('custom','/^[A-Za-z\ ]{2,30}$/'),
'message' = 'Supply real first name',
'allowEmpty' = false,
),
'lname' =