Hi all
I need to divide my form to steps so i searched on extinction to do that , then I used
http://www.yiiframework.com/extension/sformwizard
But the problem is form not sent any requests to controller ?
Any idea will help , alos any another extinction work with me .
view :
<?php
...............
$form=$this->beginWidget('CActiveForm', array(
'id'=>'courseregister-cregister-form',
'enableAjaxValidation'=>false,
'enableClientValidation'=>true,
'clientOptions'=>array('validateOnSubmit'=>true), //This is very important
));
?>
.......................
</div>
<div class="row step" id="Step2">
<table width='700px' class='tbl' >
<tr class='odd'>
<td>الأسماء</td>
<td>الأسم</td>
<td>العمل</td>
<td>البريد الإلكتروني</td>
</tr>
<tr>
<td class='odd'> المرشح 1 </td>
<td class='even'>
<?php echo $form->textField($model,'name1'); ?>
<?php echo $form->error($model,'name1'); ?>
</td>
<td class='even'>
<?php echo $form->textField($model,'work1'); ?>
<?php echo $form->error($model,'work1'); ?>
</td>
<td class='even'>
<?php echo $form->textField($model,'email1'); ?>
<?php echo $form->error($model,'email1'); ?>
</td>
</tr>
<tr>
<td class='odd'>المرشح 2</td>
<td class='even'>
<?php echo $form->textField($model,'name2'); ?>
<?php echo $form->error($model,'name2'); ?>
</td>
<td class='even'>
<?php echo $form->textField($model,'work2'); ?>
<?php echo $form->error($model,'work2'); ?>
</td>
<td class='even'>
<?php echo $form->textField($model,'email2'); ?>
<?php echo $form->error($model,'email2'); ?>
</td>
</tr>
<tr>
<td class='odd'>المرشح 3</td>
<td class='even'>
<?php echo $form->textField($model,'name3'); ?>
<?php echo $form->error($model,'name3'); ?>
</td>
<td class='even'>
<?php echo $form->textField($model,'work3'); ?>
<?php echo $form->error($model,'work3'); ?>
</td>
<td class='even'>
<?php echo $form->textField($model,'email3'); ?>
<?php echo $form->error($model,'email3'); ?>
</td>
</tr>
<tr>
<td class='odd'>المرشح 4</td>
<td class='even'>
<?php echo $form->textField($model,'name4'); ?>
<?php echo $form->error($model,'name4'); ?>
</td>
<td class='even'>
<?php echo $form->textField($model,'work4'); ?>
<?php echo $form->error($model,'work4'); ?>
</td>
<td class='even'>
<?php echo $form->textField($model,'email4'); ?>
<?php echo $form->error($model,'email4'); ?>
</td>
</tr>
<tr>
<td class='odd'>هل تحتاج فيزا <span class="required">*</span> </td>
<td class='even'>
<?php echo chtml::activeDropDownList($model,'visa',$model->getvisaOption(),array('prompt'=>'أختر الإجابة')
); ?>
</td>
<td class='odd'>إذا كان نعم فيجب تحديد التاريخ</td>
<td class='even'>
<?php
$this->widget(
'ext.jui.EJuiDateTimePicker',
array(
'model' => $model,
'attribute' => 'visa_date',
'language'=> 'ar',//default Yii::app()->language
'mode' => 'date',//'datetime' or 'time' ('datetime' default)
'options' => array(
'dateFormat' => 'yy-mm-dd',
'showAnim'=>'fold',
//'timeFormat' => '',//'hh:mm tt' default
),
)
);
?>
<?php echo $form->error($model,'visa_date'); ?>
</td>
</tr>
<tr>
<td class='odd'>حجز فندقي <span class="required">*</span> </td>
<td class='even'>
<?php echo chtml::activeDropDownList($model,'hotel',$model->getvisaOption(),array('prompt'=>'أختر الإجابة')
); ?>
</td>
<td class='odd'>في حال نعم يرجى تحديد تاريخ الوصول</td>
<td class='even'>
<?php
$this->widget(
'ext.jui.EJuiDateTimePicker',
array(
'model' => $model,
'attribute' => 'hotel_date',
'language'=> 'ar',//default Yii::app()->language
'mode' => 'date',//'datetime' or 'time' ('datetime' default)
'options' => array(
'dateFormat' => 'yy-mm-dd',
'showAnim'=>'fold',
//'timeFormat' => '',//'hh:mm tt' default
),
)
);
?>
<?php echo $form->error($model,'hotel_date'); ?>
</td>
.............................
.......................... Code
<div class="row buttons">
<input class="navigation_button" id="back" value="Previous" type="reset" />
<?php echo CHtml::submitButton('Next'); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
<?php
$this->widget('ext.sformwizard.SFormWizard',array(
'selector'=>"#courseregister-cregister-form",
'historyEnabled' =>"true",
'validationEnabled' => "true",
'validationOptions' => "true",
'formPluginEnabled' => "true",
'formOptions' => '{
success: function(data){$("#stepmessage").fadeTo(500,1,function(){ $("#stepmessage").html(data); })},
beforeSubmit: function(data){
$("#data").html("data sent to the server: " + $.param(data));
},
dataType: "json",
resetForm: true
} ',
'linkClass' =>".link",
'submitStepClass' =>".submit_step",
'back' => ":reset",
'next' => ":submit",
'textSubmit' => "تسجيل",
'textNext' => "التالي",
'textBack' =>"السابق",
'remoteAjax' =>"undefined",
'inAnimation' => "{opacity:'show'}",
'outAnimation' => "{opacity:'hide'}",
'inDuration' => 400,
'outDuration' => 400,
'easing' => "swing",
'focusFirstInput' => "true",
'disableInputFields' => "true",
'disableUIStyles' => "true",
'jsAfterStepShown'=> '
/* Available in data (data.steps ,data.settings etc):
isBackNavigation - boolean
settings - options object containing the options set for the wizard
activatedSteps - list of activated steps (visited steps)
isLastStep - boolean specifying whether the current step is a submit step
isFirstStep - boolean
previousStep - the id of the previously visited step
currentStep - the id of the current step
backButton
nextButton
steps - the steps of the wizard
firstStep - the id of the first step
*/
$("#stepmessage").html("");
$.each(data.activatedSteps, function(){
$("#stepmessage").append(this+" - ");
});
var currentstepnumber = data.activatedSteps.length;
$("#stepmessage").append("<br/>الخطوة "+currentstepnumber+"/"+data.steps.length);',
));?>
controller :
<?php
public function actionCregister()
{
$model=new Courseregister;
// uncomment the following code to enable ajax-based validation
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model) ;//You have enabled ajax validation. You have to uncomment this line.
/*
if(isset($_POST['ajax']) && $_POST['ajax']==='courseregister-cregister-form')
{
echo CActiveForm::validate($model);
Yii::app()->end();
}
*/
if(isset($_POST['Courseregister']))
{
$model->attributes=$_POST['Courseregister'];
if($model->validate())
{
//// do Something here
}
else{
//// do Something here
}
}
}
?>
thanks in advance