I just noticed another thing about your problem.
The reason why you get a preg_match error is because you weren't able
to follow the proper syntax for the validation rule.

for simple rules, you can follow this sample code (got from book):
var $validate = array(
    'fieldName1' => array(
        'rule' => 'ruleName', // or: array('ruleName', 'param1',
'param2' ...)
        'required' => true,
        'allowEmpty' => false,
        'on' => 'create', // or: 'update'
        'message' => 'Your Error Message'
    )
);

for multiple rules:
var $validate = array(
    'fieldName' => array(
        'ruleName' => array(
            'rule' => 'ruleName',
            // extra keys like on, required, etc. go here...
        ),
        'ruleName2' => array(
            'rule' => 'ruleName2',
            // extra keys like on, required, etc. go here...
        )
    )
);


On Jan 15, 1:52 pm, "Louie Miranda" <lmira...@gmail.com> wrote:
> Guys, is there a new way of doing a simple this field is required? true or
> false?
>
> The code example and my code below, does not work.
>
> My code:
>
> var $validate = array(
>
> >    'officer'=>array('required'=>true)
> > );
>
> I am using CakePHP (Stable/Latest release). I get an error of...
>
> > preg_match() [function.preg-match <http://php.net/function.preg-match>]:
> > Delimiter must not be alphanumeric or backslash [*
> > CORE/cake/libs/model/model.php*, line *2413*]
>
> Shall I always use alphanumeric on the rule? I just want to make it
> required, true or false. Is it still the same?
>
> Help!
> --
> Louie Miranda (lmira...@gmail.com)http://www.louiemiranda.net
>
> Security Is A Series Of Well-Defined Steps
> chmod -R 0 / ; and smile :)
--~--~---------~--~----~------------~-------~--~----~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to