Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Load View With Fancybox

$
0
0
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 :


<?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>&lt!-- 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 :rolleyes:






Viewing all articles
Browse latest Browse all 18717

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>