How to display page on fancybox...using CHtml::ajaxlink with yii validation

4 followers

This wiki article has not been tagged with a corresponding Yii version yet.
Help us improve the wiki by updating the version information.

1) include the fancybox extesion otherwise fancybox js

<?php
$this->widget('application.extensions.fancybox.EFancyBox', array(
    'target' => 'a[class=fancybox1]',
    'config' => array(),
        )
);
?>

2)create the CHtml::ajaxlink

echo CHtml::ajaxlink('Request New Liquor', array('liquor/addnewliquor'), array(
                "type" => "GET",
                "data" => array("vid" => $vid, "ajax" => true),
                "success" => "function(data){
                                            $.fancybox({content:data,closeBtn:false,showNavArrows:false});
                                    }",
                    ), array('live' => false, 'class' => 'blue', 'id' => rand(0, 99999)));

and write a code on controller..and renderPartial page

public function actionaddnewliquor() {
        $cs = Yii::app()->clientScript;
        $cs->reset();
        $cs->scriptMap = array(
            'jquery.js' => false, // prevent produce jquery.js in additional javascript data
            'jquery.min.js' => false,
        );
 
     $this->renderPartial('/liquor/add_new_liquor', array('model' => $model), false, true);
 }

Note: i add the jquery.js and jquery.min.js false when ajax call beacuse it's issue when open a fancy-box it's not working close button.so i can false both this js...

Hope it's helpful...

Total 2 comments

#14750 report it
Ankit Modi at 2013/09/07 03:57am
help

Hi,

please add the fancybox js otherwise fancybox extesion

sorry for this i am not include this content.

#14744 report it
Inder at 2013/09/07 02:07am
harry matharoo

workin nice but i'm getting the error $.fancybox is not a function

Leave a comment

Please to leave your comment.

Write new article