Undefined CJuiDatePicker.flat?

Hi there,

I wanted to use CJuiDatePicker.flat property. So I set it like this:


<?php 

    	$this->widget('zii.widgets.jui.CJuiDatePicker', array

    	(

            	'name'=>'Zlecenia_registrationDateStart',

            	'flat'=>true,

    	));

?>

After executing modified code I see error saying, that CJuiDatePicker.flat is undefined.

What am I missing?

In the sorce $flat is defined as false… so I don’t know how can get “undefined”… would need to debug this…

I was also surprised, as I never found any property that would be documented and would not exists.

Just did debug on a different project and got the same result.

Code producing (whole view file code):


<?php $this->pageTitle = 'Start' ?>


<h1><?php echo($this->pageTitle) ?></h1>


<?php

    	$this->widget('zii.widgets.jui.CJuiDatePicker', array

    	(

            	'name'=>'Zlecenia_registrationDateStart',

            	'flat'=>true,

    	));

?>

Exception: CJuiDatePicker.flat is undefined in yii\web\CWidgetFactory.php(162).

Stack Trace:


#0 x:\yii\web\CWidgetFactory.php(162): CComponent->__set('flat', true)

#1 x:\yii\web\CBaseController.php(139): CWidgetFactory->createWidget(Object(MainController), 'zii.widgets.jui...', Array)

#2 x:\yii\web\CBaseController.php(165): CBaseController->createWidget('zii.widgets.jui...', Array)

#3 x:\htdocs\burdzy\protected\views\main\index.php(10): CBaseController->widget('zii.widgets.jui...', Array)

#4 x:\yii\web\CBaseController.php(119): require('D:\Internet\XAM...')

#5 x:\yii\web\CBaseController.php(88): CBaseController->renderInternal('D:\Internet\XAM...', NULL, true)

#6 x:\yii\web\CController.php(798): CBaseController->renderFile('D:\Internet\XAM...', NULL, true)

#7 x:\yii\web\CController.php(739): CController->renderPartial('index', NULL, true)

#8 x:\htdocs\burdzy\protected\controllers\MainController.php(29): CController->render('index')

#9 x:\yii\web\actions\CInlineAction.php(50): MainController->actionIndex()

#10 x:\yii\web\CController.php(300): CInlineAction->run()

#11 x:\yii\web\CController.php(278): CController->runAction(Object(CInlineAction))

#12 x:\yii\web\CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array)

#13 x:\yii\web\CWebApplication.php(324): CController->run('index')

#14 x:\yii\web\CWebApplication.php(121): CWebApplication->runController('main/index')

#15 x:\yii\base\CApplication.php(135): CWebApplication->processRequest()

#16 x:\htdocs\burdzy\index.php(17): CApplication->run()

#17 {main}

Where x: stands for my server path.

Server configuration (exception footer): "2011-01-03 21:22:21 Apache/2.2.12 (Win32) DAV/2 mod_ssl/2.2.12 OpenSSL/0.9.8k mod_autoindex_color PHP/5.3.0 Yii Framework/1.1.4".

I just pasted your view code in one of my views and I’m getting the calendar displayed… no error…

Can it be that you are using an old Yii version…

Can be! :] Always can be. As I cited (last lines of my post) the CExecption footer, I’m still using Yii 1.1.4 and it is r2429 revision. But since, we are talking about some obvious behaviour of this class (rendering calendar as inline one) I would be surprised if this property would be introduced later than my current version. But… it always can be true.

And, if we are discussing CJuiDatePicker. Can you follow this thread? Is there a way to attach calendar to an existing input box or using the one generated by this class is currently the only implemented option?

At least you can check the source in your Yii folder :D

The flat option was added at r2544 - http://code.google.com/p/yii/source/detail?r=2544

So sorry! :] I would ban myself by giving minus one to myself for laziness! :]

But as I wrote above - it was more like bad assumption, not laziness. I mistakenly assumed that so obvious feature would be implemented since beginning. Sorry, again!

And I just noticed that even as you are using Yii 1.1.4 you posted on the Yii 1.0.x forum :o

That was accidentally, sorry.

moved to proper forum ;)

Thanks! As always, we can count on our good forum moderator! :]

I’m running yii-1.1.5.r2654. The problem with CJuiDatePicker still exists if flat=>true, but now the error is


Undefined index: name

Tracing down the yii code, this two lines in CJuiDatePicker.php:80 seem to fix the problem




// Current code

if(isset($this->htmlOptions['name']))

    $name=$this->htmlOptions['name'];

// This two lines added!!!

else

    $this->htmlOptions['name']=$name;



I am also running that Yii version but this:


 

$this->widget('zii.widgets.jui.CJuiDatePicker',

                        array(

                                'name'=>'cp',

                                'flat'=>true,

                                'cssFile'=>array('jquery-uii.mod.css'),

                        )

);

gives no errors…works for me.