Hi again,

I have managed to track back what I think the problem is but I'm
having a hard time thinking this is an issue inside Cake given the
number of users who are using the on parameter. If I add $this->id =
[the id of my user] as the first line inside cake/libs/model/model.php
in the invalidFields method the validation works as intended (i.e. if
the record already exists and on = create and required = true then the
rule is skipped, if the record exists and on = update and required =
true the rule is validate.

How I'm calling the validation from inside my controller is as
follows:

                        // pass the posted data into the user object
                        $this->User->data = $this->data;

                        // validate the user details
                        if ($this->User->validates()) {
                                // save the user data and redirect
                                if ($this->User->save($this->data)) {
                                        $this->set("successMessage",
"Your details have been updated.");
                                } else {
                                        $this->set("errorMessage",
"There was a problem updating your details, please try again
shortly.");
                                }
                        } else {
                                $this->validateErrors($this->User);
                        }

I notice the $this->User->validates() has $this->id empty but when
$this->validateErrors($this->User) is called the $this->id = is set.

I suspect I'm going about something the wrong way!

Cheers
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to