I have this problem and it really bothers me a lot. I was searhing whole day for a solution, and nothing helped me.
Here is the thing:
Since I am quite thin with jQuery, I am using some theme that includes a lot of jQuery plugins. I am trying to implement captcha on my Contact form. I see the captcha and it validates properly. Problem is when I turn on ( include ) .js scripts needed by other parts of my front-end, captcha do not show the link for "Get a new code", "clickableImage" does not work either. Ajax validation does not work too. When I visit the page source of the contact page it shows the script calls necessary for captha to work:
<script type="text/javascript" src="/app/assets/cbc21b17/jquery.js"></script>
<script type="text/javascript" src="/app/assets/cbc21b17/jquery.yiiactiveform.js"></script>
So Yii made a call to necessary .js files, needed for contact form that comes as a part of yii app.
It is not only captcha problem here, all yii functionalities that reqires yii generated .js will not work if I put my plugins in use. Just for the record some of these .js plugins requires .js 1.5 and 1.2 to work.
Here is the code of my contact page ( form only ) :
<!-- form -->
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'contactForm',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
)); ?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<?php echo $form->errorSummary($model); ?>
<div class="row">
<?php echo $form->labelEx($model,'name'); ?>
<?php echo $form->textField($model,'name',
array('id'=>'name','class'=>'form-poshytip', 'title'=>'Enter your name')); ?>
<?php echo $form->error($model,'name'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'email'); ?>
<?php echo $form->textField($model,'email',
array('id'=>'email','class'=>'form-poshytip', 'title'=>'Enter your email address')); ?>
<?php echo $form->error($model,'email'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'subject'); ?>
<?php echo $form->textField($model,'subject',
array('size'=>60,'maxlength'=>128, 'id'=>'subject', 'class'=>'form-poshytip',
'title'=>'Enter the subject of your request')); ?>
<?php echo $form->error($model,'subject'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'text'); ?>
<?php echo $form->textArea($model,'text',
array('rows'=>6, 'cols'=>50, 'id'=>'text','class'=>'form-poshytip',
'title'=>'Enter the text of your request')); ?>
<?php echo $form->error($model,'text'); ?>
</div>
<?php if(CCaptcha::checkRequirements()): ?>
<div class="row">
<?php echo $form->labelEx($model,'verifyCode'); ?>
<div>
<?php $this->widget('CCaptcha', array('clickableImage'=>true)); ?>
</div>
<div>
<?php echo $form->textField($model,'verifyCode'); ?>
</div>
<div class="hint">Please enter the letters as they are shown in the image above.
<br/> Letters are not case-sensitive.</div>
<?php echo $form->error($model,'verifyCode'); ?>
</div>
<?php endif; ?>
<div class="row buttons">
<?php echo CHtml::submitButton('Submit', array('id'=>'submit')); ?>
</div>
<?php $this->endWidget(); ?>
</div>
<!-- ENDS form -->
In my main.php ( main layout file in my theme ) I have these calls to jQuery plugins placed in head section:
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl.'/js/jquery-1.5.1.min.js'); ?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl.'/js/jqueryui.js'); ?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl.'/js/easing.js'); ?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl.'/js/jquery.scrollTo-1.4.2-min.js'); ?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl.'/js/quicksand.js'); ?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl.'/js/custom.js'); ?>
If I remove them, Yii generated .js works but ofc custom plugins do not, and If I put them in use then Yii generated .js does not work anymore.
I tried placing all my .js files in assets folder and calling them from there, it does not work.
Do anyone have any solution for this nightmare ?
Thanks