Submit A Form From Modal Dialog

Here I go again with my newbie help requests. I need to submit a form after it’s shown in a modal dialog. The catch is, the form refers to a different model from the view that renders it. Let’s say I’m watching a list of classrooms and I want to show a dialog to insert a new student to one of them.

In my view (say classroom/index.php) I have this code for rendering the dialog button



    array('id' => 'myModal')

    ); ?>

    <div class="modal-header">

        <a class="close" data-dismiss="modal">&times;</a>

        <h4>Add a Student</h4>


    <div class="modal-body">

        <p><?php $this->renderPartial('_myForm',array(),false)?></p>


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

            <?php $this->widget(



                    'label' => 'Click me',

                    'type' => 'primary',

                    'htmlOptions' => array(

                        'data-toggle' => 'modal',

                        'data-target' => '#myModal',




And the _myForm view file is

<div class="form">





    $model = new Student(); //this is my model

    $form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array(

    'id' => 'student-form',

    'enableAjaxValidation' => true,

    'enableClientValidation'=> false,

    )); ?>

    <p class="note">

        <?php echo Yii::t('', 'Fields with') ?> <span class="required">*</span>

        <?php echo Yii::t('', 'are required') ?>.    </p>

    <?php echo $form->errorSummary($model) ?>

                    					<?php //form fields here.. ?>


    <div class="form-actions">

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



			'label'=>$model->isNewRecord ? Yii::t('', 'Create') : Yii::t('', 'Save'),

		)); ?>

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


			'label'=> Yii::t('', 'Cancel'),

			//'htmlOptions' => array('onclick' => 'javascript:history.go(-1)')

		)); ?>


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


I’m not sure how I should code my controller. Atm after submit nothing happens: and I’m not very surprised since there’s no specific action invoked. But I’m confused… Should I use the StudentController? Or the ClassroomController? And how? :(