Thanks, this is useful. I think I must be making an assumption
somewhere that I shouldn't be making, so here's my bit of code in my
controller:

function register() {
                // Check to see if form data has been submitted
                if (!empty($this->data['User'])) {
                // Validate both passwords entered are the same
                        if ($this->data['User']['password'] !=
$this->data['User']['confirmpassword']) {
                          $this->User->invalidate('confirmpassword');
                          $this->validationErrors['User']['confirmpassword'] = 
'Passwords
must match';
                        }

                        // Validate both email addresses entered are the same
                        if ($this->data['User']['email'] !=
$this->data['User']['confirmemail']) {
                          $this->User->invalidate('confirmemail');
                          $this->validationErrors['User']['confirmemail'] = 
'E-mail
addresses must match';
                        }
                        // Try to save as normal, shouldn't work if the field 
was
invalidated.
                        if ($this->User->save($this->data)) {
                                $this->flash('You have been successfully 
registered.',
'/users/login');
                        } else {
                                $this->render();
                        }
                }
        }

What happens is, regardless of whether the passwords or emails match,
the save still goes through successfully. It looks like save() should
test to see if there are any invalidFields(), but it's still going
through. Where is my thinking wrong in this?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to