You can set the model NOT to use any table, thus using it to logically model
your data, and peform validations:
class CustomRecord extends AppModel
{
var $name = 'CustomRecord';
var $useTable = false;
var $validate = array(
'name' => VALID_NOT_EMPTY,
'email' => VALID_EMAIL
);
}
Then use normally:
if ($this->CustomRecord->create($this->data) &&
$this->CustomRecord->validates())
{
// All good
}
-MI
---------------------------------------------------------------------------
Remember, smart coders answer ten questions for every question they ask.
So be smart, be cool, and share your knowledge.
BAKE ON!
blog: http://www.MarianoIglesias.com.ar
-----Mensaje original-----
De: [email protected] [mailto:[EMAIL PROTECTED] En nombre
de dakomoon
Enviado el: MiƩrcoles, 07 de Febrero de 2007 02:10 p.m.
Para: Cake PHP
Asunto: Re: How to validate a custom form?
Steniskis is right, it's not clear what you're trying to do. If you
want to use a model class to perform your validation for you you can
use one as long as you don't try to save that data, but you need to
explicitly call the validate function on the model after it has been
populated with your data. For example if I have a model Person with
the attributes firstName and lastName and both fields are required I
could do the following.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---