Hello

I'm trying to create a user registration form. I'm having a few weird
problems with this, mostly having to do with the validation rules in
the model.

One basic problem is detecting a simple blank field. This was so easy
in 1.1, but I can't (for the life of me) figure out how this is done
in 1.2. The 'minLength' rule only seems to invalidate the field when
there is a actual text in the field, and not when it is blank..

Here are the rules for my username field in my User model for example:

        var $validate = array(

                // username field
            'username' => array(

                 // needs to be at least 4 chars long
                'minrule' => array(
                                'rule' => array('minLength', 4),
                                        'required' => true,
                                        'allowEmpty' => false,
                                'message' => 'Your Username must be at least 4 
characters
long.'
                ),

                // must be alphanumeric
                'alphanumeric' => array(
                    'rule' => 'alphaNumeric',
                    'message' => 'Only alphabets and numbers allowed.'
                 ),


                // must be a unique name
                'unique' => array(
                    'rule' => 'isUnique',
                    'message' => 'This username has already been taken.'
                ),

            ),

....

)


When I test this code, however, a blank field trips the 'alphanumeric'
rule instead of minLength - generating the wrong message.

If I enter only the letter "a" in the username field, the field is
invalidated.

Is this a bug?

Thanks,

August


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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