Cakephp Not validating data in Form
I am Trying to validate data from Form(.ctp file) in cakephp 2.3.8.
echo $this->Form->create('User').'<br />'.
$this->Form->input('handle', array(
'rule' => 'notEmpty',
'alphaNumeric' => array(
'rule' =>
'alphaNumeric',
'required' => true,
'message' =>
'Username must be only
letters and numbers,
no special characters'
),
'between' => array(
'rule' =>
array('between',
4, 8),
'message' =>
'Username must be
between 4 and 8
characters',
),
'isUnique'
=> array(
'rule'
=>
'isUnique',
'message'
=>
'This
username
is
already
taken.
Please
choose
a
different
one.'
))).'<br />'.
$this->Form->input('email',array(
'type'=>'text',
'placeholder'=>'Enter your
E-mail',
'class'=>'form-control')).'<br
/>'.
$this->Form->input('password',array(
'type'=>'password',
'placeholder'=>'Enter your
password',
'class'=>'form-control'));?>
This is my modle code
public function beforeSave($options = array()) {
parent::beforeSave($options = array());
if (isset($this->data['User']['password'])) {
$this->data['User']['password'] =
AuthComponent::password($this->data['User']['password']);
}
$this->data['User']['token'] = Security::hash(mt_rand(),'md5',true);
$this->data['User']['resetkey'] =
Security::hash(mt_rand(),'md5',true);
return true;
}
but when i singup, it not validating data and i don't know where i am
mistaking
No comments:
Post a Comment