Hi,

I've been doing some work with my users model and I got to a stage
where I was creating a method to change a users password to avoid the
default edit screen from having a populated password and such. Either
way I ended up with a change_password method and view, this works
great.

On this page I have two password fields which are checked using a
custom match rule in my model btw. Then if they pass validation I copy
one into the password field and save it. The validation is called
using $this->User->validates() in the controller.  But I was trying to
validate the password and my model was throwing all kinds of strange
errors. When I finally dropped in a die(pr($this->User-
>invalidFields())); into my controller it was showing that all the
other fields, which were marked as required were also being validated.

I got around it by adding the fields as hidden to the form and
submitting it.

The main question is, is there a way to pass any field list into
validates or create a validateFields() which takes an array of fields
to validate? Is this possible? My colleague tells me that I should
really be creating a passwords model and such and then relating it to
my User but this seems a little overkill.

In a similar circumstance which I just arrived at again, I am
forwarding a job to a friend via email and I would like to validate
the email field against the model before sending the email. Again I
can't validate just this one field without validating the whole model.
Yet again, should I be creating a ForwardtoFriend model with no table
and it's own controller to do this and then associate it with the
Vacancy?

It seems to me that it might be a bit of a hacky shortcut to be able
to specify which model fields you want to validate, but one that would
be super handy, or am I missing the point here? (which is entirely
possible ;p)

Ta,
Dave
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to