Saturday, April 24, 2010

Re: CakePHP 1.2.6 - problem with displaying form error messages

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:
function add() {
if (!empty($this->data)) {
if ($this->User->save($this->data)) {
// save some message using Session::setFlash
// redirect to whichever page you want
} else {
// Model::save has validated your data, found an issue
// view will be shown again, with validationErrors shown
// unless you have broken conventions somewhere
}
}
// show above view
}

What about this standard way of doing things (the way Cake would bake
your setup) does not suit your requirements?

HTH

Paul

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate