Ok. Thanks. But this only works if I specify exactly which columns to
save in my controller using:
$user = $this->User->save($this->data, true, array('email',
'password', 'password_confirm', 'first_name', 'last_name')
Notice I left out 'email_confirm' in the list even though that field
appears in the view. I would rather use this:
$user = $this->User->save($this->data)
However, SQL throws the following error:
SQL Error: 1054: Unknown column 'User.email_confirm' in 'where clause'
Cake wants an 'email_confirm' column in the Users table. This is key
to what I'm trying to understand. I don't have a 'password_confirm'
column EITHER. But for some reason, Cake does not mind. Is there a
built in exception for a field called 'password_confirm'?
On Feb 10, 4:55 pm, Miles J <[email protected]> wrote:
> If you are trying to match dynamic data, it wont work because Cakes
> default validation is for static data. Heres a method I use to match
> dynamic:
>
> Place this in your appmodel.
>
> /**
> * Validates two inputs against each other
> * @param array $data
> * @param string $confirmField
> * @return boolean
> */
> function validateMatch($data, $confirmField) {
> $data = array_values($data);
> $var1 = $data[0];
> $var2 = (isset($this->data[$this->name][$confirmField])) ?
> $this-
>
> >data[$this->name][$confirmField] : '';
>
> return ($var1 === $var2);
> }
>
> And then the validation rule:
>
> 'rule' => array('validateMatch', 'NAMEOFCONFIRMFIELD'),
> 'message' => 'They do not match'
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---