Hi
I created app with yii and i needed to load view form in Fancy-box so i did that but my problem when i clicked on submit button , from redirected me to controller action without validated form . How to validate form with out redirect , mean validate inside Fancy-box ?
view :
FormView _from from call from another view
Controller
Thanks in advance![:rolleyes:]()
I created app with yii and i needed to load view form in Fancy-box so i did that but my problem when i clicked on submit button , from redirected me to controller action without validated form . How to validate form with out redirect , mean validate inside Fancy-box ?
view :
<?php $config = array( ); $this->widget('application.extensions.fancybox.EFancyBox', array( 'target'=>'#getaction', 'config'=>$config,)); echo CHtml::link('Add Section',array('section/create'),array('id'=>'getaction')); ?>
FormView _from from call from another view
<div class="form"> <?php $form=$this->beginWidget('CActiveForm', array( 'id'=>'section-form', 'enableAjaxValidation'=>true, )); ?> <p class="note">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <div class="row"> <?php echo $form->labelEx($model,'name'); ?> <?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>255)); ?> <?php echo $form->error($model,'name'); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?> </div> <?php $this->endWidget(); ?> </div><!-- form -->
Controller
public function actionCreate() { $model=new Section; if(isset($_POST['Section'])) { $model->attributes=$_POST['Section']; if($model->validate()) //// Do Som code here $this->redirect(array('view','id'=>$model->id)); } $this->render('create',array( 'model'=>$model, )); }
Thanks in advance
