This should do it
'rule' => array('custom', '/^[a-z0-9 ]*$/i')

On 23 Sty, 03:52, Chris Gallop <[EMAIL PROTECTED]> wrote:
> I am trying to validate a field and I want to use alphaNumeric form of
> validation with spaces possible.  However the alphaNumeric does not
> seem to allow spaces.  Is there a validation rule I can tack on to
> allow this.
>
> My code is below and I would like the state field to be allowed to
> have spaces and be left blank.
>
>     var $validate = array(
>                 'firstname' => array('rule' => 'alphaNumeric', 'message' 
> =>'Valid
> characters: letters and numbers only'),
>         'lastname' => array('rule' => 'alphaNumeric', 'message'
> =>'Valid characters: letters and numbers only. Cannot be blank.'),
>         'email' => array('rule' => array('_isUnique', 'email'), 'rule'
> => 'email', 'message' =>'E-mail must be a valid and unqiue e-mail
> address'),
>                 'suburb' => array('rule' => 'alphaNumeric', 'message' => 
> 'Suburb
> contain only letters, including area code'),
>                 'state' => array('rule' => 'alphaNumeric', 'message' => 
> 'Suburb
> contain only letters, including area code'),
>                 'postcode' => array('rule' => 'alphaNumeric', 'message' => 
> 'Suburb
> contain only letters, including area code')
>         );
>
> Any tips appreciated.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to