I have the same problem here with 1.2 RC3. It's odd because my
username and email validation appears to be working as expect, but my
validation on the password fields isn't working. My validation rules
are as follows:
var $validate = array
(
'email' => array
(
'valid' => array
(
'rule' => 'email',
'required' => true,
'message' => 'Please enter a valid email address',
),
'unique' => array
(
'rule' => 'isUnique',
'required' => true,
'message' => 'This email address has already been used',
)
),
'username' => array
(
'unique' => array
(
'rule' => 'isUnique',
'required' => true,
'message' => 'This username has already been taken,
sorry!',
),
'alphanumeric' => array
(
'rule' => 'alphaNumeric',
'required' => true,
'message' => 'Username must be alphanumeric',
),
'empty' => array
(
'rule' => array('custom', '/\S+/'),
'required' => true,
'message' => 'Please enter your username',
)
),
'new_password' => array
(
'rule' => array('minLength', '6'),
'message' => 'Password must be at least 6 characters long',
'required' => true,
),
'confirm_password' => array
(
'empty' => array
(
'rule' => array('minLength', '6'),
'message' => 'Password must be at least 6 characters
long',
'required' => true,
),
'identical' => array
(
'rule' => array('identicalFieldValues', 'new_password'),
'message' => 'Passwords do not match',
'required' => true,
)
)
);
Interestingly, even if I change the rule for the password fields to
the custom regex I'm using for the username field, it still doesn't
work, yet the username field validation does work. I have tested the
same code on svn revision 7673 and it works. So somewhere between
revision 7673 and 7692 there has either been a bug or a change in
functionality introduced.
On Oct 5, 7:18 pm, James Pearson <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I upgraded my project from RC2 to RC3 today, and all went smoothly
> except for 1 area, validation.
>
> I have a User model, with the following validation: (a sample)
>
> var $validate = array(
>
> 'first_name' => array(
> 'alphanumeric' => array(
> 'rule' => 'alphaNumeric',
> 'message' => 'Your name can only
> contain letters.',
> ),
> 'between' => array(
> 'rule' => array('between', 1, 15),
> 'message' => 'You must supply your
> first name',
> 'required' => true
> )
> ),
> 'last_name' => array(
> 'alphanumeric' => array(
> 'rule' => 'alphaNumeric',
> 'message' => 'Your name can only
> contain letters.',
> ),
> 'between' => array(
> 'rule' => array('between', 1, 15),
> 'message' => 'You must supply your
> last name',
> 'required' => true
> )
> )
> );
>
> In CakePHP 1.2 RC3 both first_name and last_name fail to validate with
> valid values (or any value infact).
>
> I've traced this down to the regex in /cake/lib/validations.php,
> around line 170.
>
> My development machine, OS-X, PHP 5.25 this issue does not occur.
> On the server, CentOS, PHP 5.1.6 this does occur.
>
> If this is a setting in PHP, or a known issue with PHP 5.1.6 please
> let me know.
>
> James
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---