midnight mate :)

(because in here in Budapest now is midnight)

Mikee Freedom írta:
> morning mate,
>
> As a starting point, have a look at this tutorial on the wiki:
>
> http://wiki.cakephp.org/tutorials:advanced_validation
>
> Fromhere I've been able to modify this validation method to my own
> devices. You can pretty much define multiple validation methods for
> each input and create the functions yourself.
>
> I've put some of the common ones in my app_model (unique, maxlength,
> minlegth, etc) and others that are Model specific would stay in that
> particular Model.
>
> An example of the validation array could be:
>
>     function loadValidation()
>     {
>         $this->validate = array(
>             'email_address' => array(
>                 'required' => array(
>                     'method' => VALID_NOT_EMPTY,
>                     'message' => 'Please enter an Email Address.',
>                 ),
>                 'unique' => array(
>                     'method' => 'unique',
>                     'message' => 'Your Email Address is already in our
> records.',
>                     'parameters' => array('email_address',
> $_POST['data'][$this->name]['email_address'])
>                 ),
>                 'email' => array(
>                     'method' => VALID_EMAIL,
>                     'message' => 'Please enter a valid Email Address.',
>                 )
>             )
>         );
>     }
>
> You have to put it in this loadValidation function (within your model)
> and call it prior to any validation check (PHP 4 issue). If you have a
> look I have told my User model that when accepting an email address it
> has to be not empty, unique and a valid email. The unique function I
> grabbed also from the wiki (thankyou to the author who I can't
> remember at this time) and other functions i have written myself.
>   
Where can I put this functions? To this model? Or where?
> use the invalidFields function from the tutorial, and define your own
> validation function to check the password and the username. you can
> see in the array that you are able to pass parameters to your defined
> functions from the $_POST array. the validation function simply
> returns true or false based on these parameters.
>   
It was only an example the username and password, it  is a little bit 
difficultest. I like to use some other tables (models?) in this model 
what is not contact with fields to this. This some global rules. How can 
I make it easier?
> if you need any further clarification let me know.
>
> cheers,
> freedom
>
> On 23/08/06, Ámon Tamás <[EMAIL PROTECTED]> wrote:
>   
>> Hello,
>>
>> How can I validate 2 fields? for example I have a username and a
>> password, and I like to validate this two filelds are not the same?
>>
>> --
>> Tamas Amon
>>     
>   


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

Reply via email to