jQuery(...).activeform is not a function in Yii

hd. picture hd. · May 30, 2013 · Viewed 19.6k times · Source

I am developing a project with Yii.

I need to use jquery ui on many pages of site. So I add jquery core library and jquery ui library in the layout of site to have access to them on all the pages.

But it causes problem on the pages which have a form (active form). I see this error on the firebug :

jQuery(...).activeform is not a function

why is it so? How can I resolve it?

Thank you.

Answer

Michael Härtl picture Michael Härtl · May 30, 2013

If you include jQuery core libraries manually in your layout file, it could be possible that jQuery gets loaded a second time and overrides the original jQuery object which had the Yii plugins attached.

You should use Yii::app()->clientScript->registerCoreScript('jquery.ui') instead.