I have a link that looks like
<a class="fancy" href="/site/feedback">feedback</a>
Ajax call:
$('.fancy').fancybox({
wrapCSS: 'custom-fancy',
padding: 0,
type: 'ajax'
});
On click fancybox load content wich controller send.
$this->renderPartial('_feedback')
Feedback view:
<?php
/* @var $this Controller */
/* @var $model FeedbackForm */
/* @var $form CActiveForm */
$form = $this->beginWidget('CActiveForm', array(
'id' => 'feedback-form',
'enableClientValidation' => TRUE,
)); ?>
<div><?= $form->textArea($model, 'feedback') ?></div>
<?=$form->error($model, 'feedback')?>
<? $this->widget('CCaptcha') ?>
<?=$form->textField($model, 'verifyCode', array('placeholder' => 'Captcha code'))?>
<div><?=CHtml::submitButton('Send', array('class' => 'r button'))?></div>
<? $this->endWidget() ?>
The problem is that there is no javascript/ajax validation on this loaded form. I think, it is because some Yii scripts did not loaded after ajax call (yiiActiveForm.js maybe, I don’t know).
What is the best solution for this situation?
Well, you need to load some code with javascript