Assuming that User is your model, you would use $this->User->validates().
Mariano gave a good example in his response: if ($this->User->set($this->data) && $this->User->validates()) { // Perform your thing to check user / password } You could also do the reverse: if (!$this->User->validates()) { $this->Session->setFlash('Please enter a valid username and password') $this->redirect(array('action'=>'login'), null, true); } rhett waldock clearsite new media -----Original Message----- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of cecplex Sent: Tuesday, March 06, 2007 5:10 PM To: Cake PHP Subject: Re: Different Validations on 1 Table (Model) Based on the Action If that's the case, how would I handle errors in a login form? On Mar 6, 6:09 pm, "Rhett Waldock" <[EMAIL PROTECTED]> wrote: > Hello, > > Can you provide more information about how you are using save() in your > controllers? > > The model-defined validation rules that apply automatically to save() would > usually be used in an insert or update operation. Presumably, the signup > action you describe would be in this category. > > However a more abstract action like a login, which presumably does a select > operation and compares the fields wouldn't be likely to use save(). > > rhett waldock > clearsite new media > > -----Original Message----- > From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf > > Of cecplex > Sent: Tuesday, March 06, 2007 4:09 PM > To: Cake PHP > Subject: Different Validations on 1 Table (Model) Based on the Action > > I'm very new to CakePHP, I've only worked with it for a day or so now. > However, I'm confused as to how validation is handled when you want to > perform different actions. > > For example: > > I have a login form that has a username and password required field. > THEN I have a Signup form that has a username and password and > firstname, lastname, email and other fields. > > When I run the save(); function from my controllers, i want it to > validate differently based on the action. (Either a signup or a login) > > Can someone explain this a bit more? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~----------~----~----~----~------~----~------~--~---