Could someone please help me out with something which is really frustrating me:
With the code below the datepicker popup refuses to appear. In Firebug I noticed that the css and js files for the datepicker are not being included.
I have used "dateFieldControlGroup" and then, as shown in this post, I used "customActiveControlGroup", but for neither does the popup appear.
Below the "customActiveControlGroup" there is a portion of code commented out. When I do include this bit of code, then the popup appears, and I notice in Firebug that the relevant WhDateTimePicker js and css is included…
Here is the code of the form:
<?php
/* @var $this MemberController */
/* @var $model Member */
/* @var $form TbActiveForm */
?>
<div class="form">
<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm', array(
'id'=>'member-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,
//'layout'=>'horizontal',
)); ?>
<p class="help-block">Fields with <span class="required">*</span> are required.</p>
<?php echo $form->errorSummary($model); ?>
<?php echo $form->textFieldControlGroup($model,'Name',array('span'=>5,'maxlength'=>64)); ?>
<?php echo $form->textFieldControlGroup($model,'Surname',array('span'=>5,'maxlength'=>64)); ?>
<?php echo $form->emailFieldControlGroup($model,'Email',array('span'=>5)); ?>
<?php echo $form->textFieldControlGroup($model,'Phone',array('span'=>3)); ?>
<?php echo $form->dateFieldControlGroup($model,'FromDate',array('span'=>2)); ?>
<?php //echo $form->dateFieldControlGroup($model,'ToDate',array('span'=>2)); ?>
<?php $datePicker = $this->widget('yiiwheels.widgets.datetimepicker.WhDateTimePicker', array(
'model' => $model,
'attribute' => 'ToDate',
'pluginOptions' => array(
'format' => 'dd.mm.yyyy',
'language' => 'uk',
),
), true); ?>
<?php echo TbHtml::customActiveControlGroup($datePicker, $model, 'ToDate'); ?>
<?php /*
<div class="control-group ">
<label class="control-label" for="Member_ToDate">To</label>
<div class="controls">
<?php
$this->widget('yiiwheels.widgets.datepicker.WhDatePicker',
array(
'model' => $model,
'attribute' => 'ToDate',
'pluginOptions' => array(
'format' => 'yyyy-mm-dd'
)
)
);
?>
</div>
</div>
*/?>
<div class="form-actions">
<?php echo TbHtml::submitButton($model->isNewRecord ? 'Create' : 'Save',array(
'color'=>TbHtml::BUTTON_COLOR_PRIMARY,
'size'=>TbHtml::BUTTON_SIZE_LARGE,
)); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
I probably should add my main.php config file ( I use “setPathOfAlias” instead of the ‘aliases’ array because otherwise Yiistrap and Yiiwheels does not work at all):
...
// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');
Yii::setPathOfAlias('yiiwheels', dirname(__FILE__).'/../extensions/yiiwheels');
// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'Auroville Entry Service',
/*
'aliases' => array(
// yiistrap configuration
'bootstrap' => realpath(__DIR__ . '/../extensions/bootstrap'), // change if necessary
// yiiwheels configuration
'yiiwheels' => realpath(__DIR__ . '/../extensions/yiiwheels'), // change if necessary
),
*/
...