0
  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

4

1 回答 1

0

因为 cakephp 2 不支持 ajax 助手。你需要学习如何使用 js 助手检查这个链接:js helper

于 2013-03-27T05:38:58.173 回答