This is driving me crazy.
User Model:
var $validate = array(
'username' => array(
'usernameRule-1' => array(
'rule' => array(
'notEmpty'),
'message' => 'Please choose a Username',
'required' => true,
'allowEmpty' => false,
'last' => true),
'usernameRule-2' => array(
'rule' => array(
'minLength', 8),
'message' => 'Username must be 8 characters or more',
'required' => true,
'allowEmpty' => false,
'last' => true)
)
);
View:
<?php echo $form->create('User', array('controller' => 'user', 'action' =>
'registration'));?>
<?php echo $form->input('User.username');?>
<?php echo $form->end('Submit');?> </div>
Controller:
function registration()
{
if (!empty($this->data)) {
if ($this->User->validates()) {
$this->Session->setFlash('All valid.');
} else {
$errors = $this->User->invalidFields();
debug($errors);
$this->Session->setFlash('There was an error signing up.
Please, try again.');
}
}
}
I removed everything but 1 field.
No matter what I enter all I get is Please choose a Username. Enter 100
characters and same message.
$errors returns:
I have abcdefghijklmnop as a username, more than 8, not empty....does not
matter what I enter it always the same thing.
Array
(
[username] => Please choose a Username
)
Please someone, anyone letmeknow what I am doing wrong?
Thanks
Dave
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---