未捕获的类型错误:Object[Object Object]没有方法';yiiactiveform';当&#


Uncaught TypeError: Object [object Object] has no method 'yiiactiveform' when 'enableAjaxValidation'=>true,

在经典的gii生成的php代码中:

$form=$this->beginWidget('CActiveForm', array(
    'id'=>'stuff-form',
    'enableAjaxValidation'=>true, ...

如果我设置"enableAjaxValidation"=>true,则会显示此javascript错误(并且验证不起作用):

Uncaught TypeError: Object [object Object] has no method 'yiiactiveform'

显然问题是我包含了我自己的jquery.js.

解决方案是在布局的开头添加这一行:

Yii::app()->clientScript->registerCoreScript('jquery');

相关:http://www.yiiframework.com/forum/index.php/topic/17846-jquery-conflict-ajax-validation-not-working/