How To Use Juidatetimepicker Extension In Forms

How can I use juidatetimepicker extension to select date time in form field. Currently I am doing it like this but it is giving me error.


<?php echo $form->textFieldRow($user,'expirationTime', $this->widget('ext.timepicker1.EJuiDateTimePicker',array(

    'model'=>$user,

    'attribute'=>'expirationTime',

    'options'=>array( 

        'timeFormat'=>'HH:mm:ss',

        'showSecond'=>true,

        'hourGrid'=>4,

        'minuteGrid'=>10,

    ),

    'htmlOptions'=>array(

        'class'=>'input-medium'

    )

))); ?>

It is giving me following error Fatal error: Cannot use object of type EJuiDateTimePicker as array in C:\xampp\htdocs\DGMwebapp\protected\extensions\bootstrap\widgets\input\TbInput.php

Hi,

Please try this code

$this->widget(‘application.extensions.timepicker.EJuiDateTimePicker’,array(

		'model'=&gt;&#036;model,


		'attribute'=&gt;'begin',


		'options'=&gt;array(


				'hourGrid' =&gt; 4,


				'hourMin' =&gt; 6,


				'hourMax' =&gt; 22,


				'timeFormat' =&gt; 'h:mm',


				'changeMonth' =&gt; true,


				'changeYear' =&gt; false,





				'timeOnlyTitle' =&gt; 'Starttime:',


				'timeText' =&gt; 'time:',


				'hourText' =&gt; 'hrs.',


				'minuteText' =&gt; 'Min.',


			//	'secondText' =&gt; 'Sec.',


				'currentText' =&gt; 'Now',


				'closeText' =&gt; 'Done',


			),


		'htmlOptions'=&gt;array(


				'value'=&gt;&#036;model-&gt;begin,


			), // htmloptions


		));


?&gt;

Thanks

chandran nepolean

Hello chandran thanks for your reply but I think you are just giving me various options of widget. I know all of these but how should I implement it in my form so that user can choose date using widget while filling form. In my post I had mentioned how I am trying to use widget and the error I am getting. So can you please tell how should I use it in my form and not the various options of widget. The error is due to how I am using the widget in my form.

I think you can just remove the textfield

Hi,

You can just remove textFieldRow and just use this widget.

I saw in your code that you are binding this widget to textFieldRow.

This widget gives you textfield with option selecting time. I have used in my project.

Thanks

chandran nepolean

thanks Maggie Q & chandran it is working now I just had to remove the textfieldrow.