Here are some of my validation rules, in case this helps any... btw, in the
view, I use $form->input of course, which displays validation messages if
any
A note to keep in mind, this works great for user registration, but I
haven't build a method for editing users yet. the 'validateUnique' rules
might need to be tested/inspected to make sure it works for editing existing
entries
var $validate = array(
'username' => array(
'length' => array( 'rule' => array('between', 6, 40), 'message'
=> 'Your username must have between 6 and 40 characters'),
'unique' => array( 'rule' => array('validateUnique',
'username'), 'message' => 'The username you entered already exists' ),
),
'password' => array(
'length' => array( 'rule' => array('between', 6, 40), 'message'
=> 'Your password must have between 6 and 40 characters'),
),
'email' => array(
'length' => array( 'rule' => array('between', 1, 255), 'message'
=> 'Your email must have between 1 and 255 characters'),
'unique' => array( 'rule' => array('validateUnique', 'email'),
'message' => 'The email address you entered already exists' ),
'format' => array( 'rule' => 'email', 'message' => 'The email
address you provided is not valid'),
),
'first_name' => array(
'length' => array( 'rule' => array('between', 1, 64), 'message'
=> 'Your first name must have between 1 and 64 characters'),
),
'last_name' => array(
'length' => array( 'rule' => array('between', 1, 64), 'message'
=> 'Your last name must have between 1 and 64 characters'),
),
);
On 6/28/07, Howard Glynn <[EMAIL PROTECTED]> wrote:
>
>
> On 6/28/07, francky06l <[EMAIL PROTECTED]> wrote:
>
> > Hello,
> > I am working on validation in 1.2 and I discovered some "strange"
> > behaviors.
> >
>
>
> I would really like for someone to post their "real world" working
> 1.2validation
> model using a varied mix of the capabilities. I've read most of the docs
> but
> still don't have a clear picture. I'm sure an actual example would be
> useful,
> and I would hazard a guess most of us could work out what we need to know
> from that and better exploit the feature. I'm sure I can do better than
> valid_not_empty :-)
>
> HG
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---