That's correct. 'last' => true means that if this rule fails no more will be 
processed for that field. If you have three rules for a field and you are not 
using 'last', you'll only see the validation error for the last failing rule.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 15 Oct 2011, at 08:40, WebbedIT wrote:

> @mark: I've used this various times, but never fully got my head
> around it.  Are you saying that whenever creating multiple rules per
> field you should add last=>true to all of them (not neccessary for
> last one I assume).  This will ensure validation stops for that field
> on the first failed rule I assume.
> 
> Paul.
> 
> On Oct 14, 9:07 pm, euromark <[email protected]> wrote:
>> there is a reason why I strongly voted in favor of changing the
>> default value for last from false to true...^^
>> 
>> "Always use “last”=>true for your rules. Unfortunately, the default
>> value is still false here. “true” makes sure that after the first rule
>> already returned false, the following ones are not checked as well
>> (overhead and totally useless)."
>> @seehttp://www.dereuromark.de/2010/09/21/saving-model-data-and-security/
>> for details
>> 
>> On 14 Okt., 20:46, heohni <[email protected]>
>> wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> I found another strange thing:
>> 
>>> this is the complete model validation:
>>> var $validate = array(
>>>         'ben_name' => array(
>>>             'required' => array('rule' => 'notEmpty', 'message' =>
>>> 'EmptyName')
>>>         ),
>>>         'ben_email' => array(
>>>             'required' => array('rule' => 'notEmpty', 'message' =>
>>> 'EmptyEmail'),
>>>             'email' => array('rule' => array('email', true), 'message'
>>> => 'SyntaxEmail'),
>>>             'unique' => array('rule' => 'isUnique', 'message' =>
>>> 'EmailNotUnique')
>>>         ),
>>>         'ben_password' => array(
>>>             'required' => array('rule' => 'notEmpty', 'message' =>
>>> 'EmptyPassword')
>>>         )
>>>     );
>> 
>>> And this I have in my view
>>> <?php echo $this->Form->input('ben_name', array('label'=>__('* Name',
>>> true), 'div' =>'row')); ?>
>>> <?php echo $this->Form->input('ben_email', array('label'=>__('* E-Mail
>>> Adresse', true), 'div' =>'row')); ?>
>>> <?php echo $this->Form->input('ben_password', array('label'=>__('*
>>> Passwort', true), 'div' =>'row')); ?>
>> 
>>> The name rule works just perfect.
>>> The email rule so..so... see first posting above
>>> And the password field gets completely ignored...
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
> 
> 
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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