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

StackOverflow https://stackoverflow.com/questions/18218543

  •  24-06-2022
  •  | 
  •  

In classic gii-generated php code:

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

If I set 'enableAjaxValidation'=>true, this javascript error shows up (and validation doesnt work):

Uncaught TypeError: Object [object Object] has no method 'yiiactiveform'
有帮助吗?

解决方案

Apparently the problem was that I have included my own jquery.js.

The solution is to add this line in beginning of the layout:

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

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top