Popup A Window If Checkbox Is Checked In Yii

I will appreciate if somebody could help me to find how to solve out one problem, I have a checkbox in my create form. If i pushed the create button I want to have a popup window if the checkbox is checked and do nothing if the checkbox is unchecked.

Here is what I started.

[sub]<?php echo $form->checkBoxRow($model, ‘default’); ?>

<div class="form-actions">

&lt;?php &#036;this-&gt;widget('bootstrap.widgets.TbButton', array(



    'label'=&gt;&#036;model-&gt;isNewRecord ? 'Create' : 'Save',

)); ?&gt;



add javascript code to do that

tried it already sir. i tried it like this… in my button create.

<?php $this->widget('bootstrap.wigets.TbButton', array(



            'label'=>'Create new day',


                'onclick'=>"{addDay(); $('#dialogDay').dialog('open');}",





this is my cjuidialog


$this->beginWidget('zii.widgets.jui.CJuiDialog', array( // the dialog



        'title'=>'Create Day',







<div class="divForForm"></div>

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

this is my javascript

<script type="text/javascript">

    function addModal()


        if (($('#default').prop("checked"))){

            <?php echo CHtml::ajax(array(







                    if(data.status == 'failure')


                    $('#dialogDay div.divForForm').html(data.div);

                    $('#dialogDay div.divForForm form').submit(addModal);




                        $('dialogDay div.divForForm').html(data.div);

                        setTimeout(\"$('#dialogDay').dialog('close') \",3000);




            return false;


        else {}//show some notification or what you want here



this is my actioncreate.

public function actionCreate()


        $model=new Day;

        // Uncomment the following line if AJAX validation is needed









                    echo CJSON::encode(array(


                        'div'=>"Classroom successfully added"










            echo CJSON::encode(array(









it displays data and immediately proceeds to submitting the data. what I want is if the checkbox is checked display the modal and inside that modal it displays something and there is submit button there. if the checkbox is not checked, submit the data immediately.