Hey Yiim,
another question is also date related…
in my form batch_start_date & batch_end_date are two dates and.and when i am creating a batch it works proper. but when in the creation of course i ve to create one batch also.at that time i ve set batch_start_date & batch_end_date as safe,ie null value…the batch and course created…
but when i am updating that batch at that time datepicker show me date from 01-01-1970 …
what is the solution for this.
<?= $form->field($model, 'batch_name', ['template' => "{label} {input} <span class='status'> </span>{error} "])->textInput(['maxlength' => 60]) ?>
<?= $form->field($model, 'batch_start_date', ['template' => "{label} {input} <span class='status'> </span> "])->widget(yii\jui\DatePicker::className(),
[
'clientOptions' =>[
'dateFormat' => 'dd-mm-yyyy',
'changeMonth'=> true,
'changeYear'=> true,
'autoSize'=>true,
'yearRange'=>'1900:'.(date('Y')+1),
'showOn'=> "button",
'buttonImage'=> Yii::$app->homeUrl."images/calendar.png",
'htmlOptions'=>[
'style'=>'width:250px;',
'class'=>'form-control',
],]]) ?>
<?= $form->field($model, 'batch_end_date', ['template' => "{label} {input} <span class='status'> </span> "])->widget(yii\jui\DatePicker::className(),
[
'clientOptions' =>[
'dateFormat' => 'dd-mm-yyyy',
'changeMonth'=> true,
'changeYear'=> true,
'autoSize'=>true,
'yearRange'=>'1900:'.(date('Y')+1),
'showOn'=> "button",
'buttonImage'=> Yii::$app->homeUrl."images/calendar.png",
'htmlOptions'=>[
'style'=>'width:250px;',
'class'=>'form-control',
],]]) ?>
<?php if(empty($_REQUEST['courseId'])) { ?>
<?= $form->field($model, 'course_id', ['template' => "{label} {input} <span class='status'> </span> "])->dropDownList(ArrayHelper::map(app\modules\course\models\Course::find()->all(),'course_id','course_name'),['prompt'=>'--Select Course--']);
?>
<?php }
else{ ?>
<?= Html::activeHiddenInput($model, 'course_id',['value'=>$_REQUEST['courseId']]); ?>
<?php } ?>
<?php //$form->field($model, 'academic_term_id', ['template'=> "{label} {input} <span class='status'> </span>"])->dropDownList(ArrayHelper::map(app\models\AcademicTerm::find()->all(),'academic_term_id','academic_term_name'),['prompt'=>'---Select Academic Term---']);
?>
<?= $form->field($model, 'batch_fees', ['template' => "{label} {input} <span class='status'> </span> "])->textInput() ?>
<?= $form->field($model, 'batch_intake', ['template' => "{label} {input} <span class='status'> </span> "])->textInput() ?>
here is my form …
hope for best solution from you.
Thanks.
regards,
janvi.