Hi all,

Quick question--my password2 field isn't validating in the edit
function.  I even tried setting the invalidate fcn in the controller
but no go.  I feel like it has something to do with this section fo
the manual:

"If you want to invalidate a piece of data that is outside of the
Model itself, be sure to add that data to the Model using the set()
method. This informs the model about that data so it can be handled
properly."

But I can't figure it out.  Any help is much appreciated.

in users_controller:

function edit($id = null) {
                if($this->Session->check('CurrentUser')){
                                $id = 
$this->Session->read('CurrentUser.User.id');
                                }
                if (empty($this->data)) {
                        if (!$id) {
                                $this->Session->setFlash('Invalid id for User');
                                $this->redirect('/users/index');
                        }
                        $this->data = $this->User->read(null, $id);
                        $this->data['User']['email2'] = 
$this->data['User']['email'];
                        $this->data['User']['password2'] = 
$this->data['User']['password'];
                } else {
                        $this->cleanUpFields();
            // Invalidate the field to trigger the HTML Helper's error
messages
            if ($this->data['User']['password2'] != $this->data['User']
['password'] )
            {
                $this->User->invalidate('password2');
            }
                        if ($this->User->save($this->data)) {
                                $this->Session->setFlash('The User has been 
saved');
                                $this->redirect('/accounts/myconnectnotes');
                        } else {
                                $this->Session->setFlash('Please correct errors 
below.');
                        }
                }
        }


In User model:

function beforeValidate()
    {

 if ($this->data[$this->name]['password'] != $this->data[$this->name]
['password2']) {
                $this->invalidate('password2');
            }
}

--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to