Your problem id that you invalidated the confirm_password field. Since
'confirm_password is not part of the model, that will not prevent the
model from saving the rest of the data.
Original function:
function index() {
if (!empty($this->data)) {
if(($this->data['Client']['password'])!=($this->data['Client']
['confirm_password']))
$this->Client->invalidate('confirm_password');
if ($this->Client->save($this->data)) {
$this->flash('Your post has been saved.','/clients/
register2');
}else{
$this->render();
}
}
}
Try this instead:
function index() {
if (!empty($this->data)) {
if(($this->data['Client']['password'])!=($this->data['Client']
['confirm_password']))
$this->Client->invalidate('password');
$this->Client->invalidate('confirm_password');
if ($this->Client->save($this->data)) {
$this->flash('Your post has been saved.','/clients/
register2');
}else{
$this->render();
}
}
}
Or this:
function index() {
if (!empty($this->data)) {
if(($this->data['Client']['password'])!=($this->data['Client']
['confirm_password']))
$this->Client->validates($this->data);
$this->Client->invalidate('confirm_password');
if ($this->Client->save($this->data)) {
$this->flash('Your post has been saved.','/clients/
register2');
}else{
$this->render();
}
}
}
On May 31, 4:06 am, cake_learner <[EMAIL PROTECTED]> wrote:
> I want confirm password to be validated. (Both password and confirm
> password should be same)
>
> views:
>
> Password
> <?php echo $html->tagErrorMsg('Client/password', 'Password is
> required.') ?>
> <?php echo $html->input('Client/password', array('size' =>
> '10'))?>
> <p>
>
> Confirm Password
> <?php echo $html->tagErrorMsg('Client/confirm_password',
> 'Confirm
> Password is required.') ?>
> <?php echo $html->input('Client/confirm_password',
> array('size' =>
> '10'))?> <p>
>
> controller:
>
> function index() {
>
> if (!empty($this->data))
> {
>
>
> if(($this->data['Client']['password'])!=($this->data['Client']
> ['confirm_password']))
> $this->Client->invalidate('confirm_password');
>
> if ($this->Client->save($this->data))
> {
> $this->flash('Your post has been saved.','/clients/
> register2');
> }
> else
> {
> $this->render();
> }
> }
>
> }
>
> The above code is not working.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---