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

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

  •  19-10-2022
  •  | 
  •  

Question

I am using Yii form Like this.

 <?php $form=$this->beginWidget('CActiveForm', array(
                    'id'=>'customerContactForm',
                     'action' => array( '/customer/ContactFormEmail' ), 
                    'enableClientValidation'=>true,
                    'clientOptions'=>array(
                        'validateOnSubmit'=>true,
                                       ));>?

On console I Got this error,

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

But after searching about this problem,I add this line of code to my view file.

<script type="text/javascript" src="../assets/795f6a2f/jquery.yiiactiveform.js"> </script>

It start working,But I do not want to get js from assets folder.So I try this

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

But I am getting the same problem.

No correct solution

OTHER TIPS

You must connect Jquery Before than yiiactiveform. As is often the case that the Jquery file is connected to the page twice. You need to remove the explicit connection Jquery in view code. The framework will decide when it needs.

If you do need one to do it manually - insert only the following code in the page header: Yii::app()->clientScript->registerCoreScript ('jquery');

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top