That's actually the exact code I have in my own model validation, and it
works perfectly for alphanumeric with spaces.

On Jan 23, 2008 3:16 AM, Marcin Jaworski <[EMAIL PROTECTED]> wrote:

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


-- 
In the name of Life, Liberty, and the pursuit of my sanity.
Siebren Bakker(Aevum Decessus)
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d- s+: a19 C++++ UL++ P L++
!E W++ N(-) o? K? w(+) O? M-- V?
PS+ PE Y- PGP- t+ 5? X- R tv--
b++ Di D+ G+ e h! r y-
------END GEEK CODE BLOCK------

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

Reply via email to