Ajax Submit, Recaptcha Problem After Validation Fails

I have a modal dialog in which I’m making form submission via Ajax

First time it successfully loads recaptcha.

But if there is validation error and it reloads content again, captcha doesn’t show! There is empty space instead of captcha.

Please suggest where I’m wrong.

In main view I have

<div id="modaladd-content">

            <?php $this->renderPartial('partials/addsiteform3', array('model'=>$model)); ?>


partials/addsiteform3.php :



$form = $this->beginWidget('CActiveForm', array(

    'id' => 'addwebsite-form',

    'action' => array('site/addsite'),

    'enableAjaxValidation' => false,



<div class="row">

    <?php echo $form->labelEx($model, 'dName'); ?>

    <?php echo $form->textField($model, 'dName', array('size' => 20, 'maxlength' => 128)); ?>

    <?php echo $form->error($model, 'dName'); ?>





    $publickey = "xxx"; // you got this from the signup page

    echo recaptcha_get_html($publickey);



echo CHtml::ajaxButton("Submiiit", CController::createUrl('site/addsite'), array(


    'update' => '#addwebsite-form'));


<?php $this->endWidget(); ?>

in Controller:

    public function actionAddsite() {

        if (isset($_POST['AddSiteForm'])) {

            $model = new AddSiteForm();

            $model->attributes = $_POST['AddSiteForm'];

            if ($model->validate()) {

                echo 'Success!';


            else {

                $this->renderPartial('partials/addsiteform3', array('model' => $model), false, true) ;