CCaptcha doesn't render refresh link

I have a problem with the refresh link in my form.

I use the captcha in my contact form and there it works fine.

In annother form it don’t render the refresh link. The view code for the captcha is the same as in the contact form.

<?php if(CCaptcha::checkRequirements()): ?>

	<div class="row captcha">

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


		<?php $this->Widget('CCaptcha'); ?>

		<?php echo $form->textField($model,'verifyCode'); ?>


		<div class="hint"><?php echo yiiparam('captchaHint'); ?></div>

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


<?php endif; ?>

This form is shown in a juiDialog. I think that must be the problem.

This is the js code in the view call the form:

//this function is called from the link or button

	function showAdRequestForm() {


      url: base_url+'/ad/adrequest',

      data: $(this).serialize()+'&requestType=adrequest&adId='+ <?php echo $model->id;?>,






    return false; 


This is my controller action code:


	 * Send an email to the advertiser or a violation email to the webmaster.


	public function actionAdRequest(){

	  $model=new AdRequestForm();


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



      if($model->validate()) {

        $msg_error='Ihre Anfrage konnte nicht weitergeleitet werden';

        $msg_success=$model->requestType=='adrequest'?'Ihre Anfrage wurde an den Anbieter weitergeleitet': 'Ihr Anliegen wurde an den webmaster von'. Yii::app()->name. ' weitergeleitet.';

                //We send the email to the advertiser




        else {



        echo CJSON::encode(array(







    $div=$this->renderPartial('_form_dialog_request', array('model'=>$model), true);

    echo CJSON::encode(array(





What is your problem? What do you expect to happen and what actually happens? Didn’t get your problem…

The refresh link "Generate new image" is not rendered in the dialog form, in the contact form it is rendered.

The button is added by javascript as you can see in the code here:

Make sure your javascript is added to html output, runs without errors and that the id used be CCaptcha is unique.

The problem was that a second jquery script was registered.

I use now the renderBegin() and renderEnd() functions to render my form and then it works.

Annother possibility is the NLSClientScript extension to prevent more then one registration of jquery.