I am using renderParial() function to render views->subscriber->_form from views->layouts->main.php Problem i am getting is I am failed to insert data using this. Gii generated CRUD is working perfectly but when i render _form and want to insert data in database it's not working. Here is my code. main.php
<div class="col-lg-6" style="text-align:right;">
<span>Subscribe Newsletter</span>
<div style="float:right;margin-left:10px;">
<?php
$model=new Subscription();
$this->renderPartial("/subscription/_form",array('model'=>$model));?>
</div>
and _form.php
<?php
/* @var $this SubscriptionController */
/* @var $model Subscription */
/* @var $form CActiveForm */
?>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'subscription-form',
// Please note: When you enable ajax validation, make sure the corresponding
// controller action is handling ajax validation correctly.
// There is a call to performAjaxValidation() commented in generated controller code.
// See class documentation of CActiveForm for details on this.
'enableAjaxValidation'=>false,
)); ?>
<?php echo $form->errorSummary($model); ?>
<div class="row">
<?php echo $form->textField($model,'email',array('size'=>30,'maxlength'=>30,'placeholder'=>'Email Address')); ?>
<?php echo $form->error($model,'email'); ?>
<?php echo CHtml::submitButton($model->isNewRecord ? 'Subscribe' : 'Save',array('class'=>'btn btn-xs btn-success subscribeBtn')); ?>
</div>
<?php $this->endWidget(); ?>
</div>