CakePHP Observe field for validation check(already exists)

Posted by deck john on Stack Overflow See other posts from Stack Overflow or by deck john
Published on 2012-12-15T05:01:46Z Indexed on 2012/12/15 5:03 UTC
Read the original article Hit count: 184

Filed under:
|
|
  1. i have already user observe field in cakephp 1.3 Now i want to do the same thing in cakephp 2.0 I have one form.there is a one field named email. When user insert email. onblur there is a popup one message that displays "email already exists" or "right"

for that i have write below code in my projects. the below code is my add file code

<?php $options = array('url' => array( 'controller' => 'users', 'action' => 'is_exist'), 'update' => 'email_exist');
        echo $this->ajax->observeField('UserEmailId',array('url' => array( 'controller' => 'users', 'action' => 'is_exist'), 'update' => 'email_exists'));  ?>

In my controller i have created one function like

 public function is_exist($id = null)
    {
    $result = "yes";
    $this->set('existdata',$result);
    }

i have also created is_exists.ctp fiel in view/uers. i dont know why its not working. i did the same thing in Cakephp 1.3 and its working file but not in cakephp 2.0 can anyone tell me how i implement this ? thanks in advance

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about cakephp-1.3