Yii Framework Forum: Add Datepicker In Form - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Add Datepicker In Form yii add datepicker in form

#1 User is offline   Sivanthi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 14-February 13
  • Location:Nagercoil, Kanya Kumari, Tamilnadu. India

Posted 18 March 2013 - 01:09 AM

I just learned how to add datepicker in form.



echo $form->labelEx($model,'datecolumn name');



The Above line display label for date column.


$this->widget('zii.widgets.jui.CJuiDatePicker',array(
				'name'=>'Modelname[datecolumn name]',
				'id'=>'Modelname_datecolumn name',
			    'value'=>Yii::app()->dateFormatter->format("d-M-y",strtotime($model->datecolumn_name)),
				'options'=>array(
    				'showAnim'=>'fold',
				),
				'htmlOptions'=>array(
    				'style'=>'height:20px;'
				),
			)); 




from the above lines,

name and id attributes are represent html attributes [name,id] of the input.

value option displays saved date during edit / update operation.
2

#2 User is offline   Lal Zada 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 125
  • Joined: 06-November 12
  • Location:Lahore, Pakistan

Posted 20 March 2013 - 06:07 AM

THnxxxxxxxx......it works fine <><>
Is it fast? Is it secure? Is it professional? Is it right for my next project? Yes, it is

Linkedin Facebook Twitter Google+
0

#3 User is offline   Debasis 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 31
  • Joined: 07-August 14

Posted 22 August 2014 - 12:18 AM

Thnx itz wworks for me too
0

#4 User is offline   Mr Thiem 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 06-September 14

Posted 06 September 2014 - 09:18 AM

This is work for me too. Thanks
0

#5 User is offline   Doan Bao 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 14-April 14

Posted 28 September 2014 - 10:49 PM

so great, thanks
0

#6 User is offline   Mr Brow 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 30-May 12

Posted 16 October 2014 - 04:33 AM

You save my times. Thanks!
0

#7 User is offline   3not7 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 07-October 14
  • Location:India

Posted 16 October 2014 - 05:00 AM

:( this doesn't works for me..... no data is being saved in the database

<div class="row">
<?php echo $form->labelEx($model,'arrival'); ?>
<?php $this->widget('zii.widgets.jui.CJuiDatePicker',array(
'name'=>'arrival',
'id'=>'arrival',
'value'=>Yii::app()->dateFormatter->format("d-M-y",strtotime($model->day_nos)),
'options'=>array(
'showAnim'=>'fold',
),
'htmlOptions'=>array(
'style'=>'height:20px;'
),
)); ?>
<?php echo $form->error($model,'arrival'); ?>
</div>

Please Help :unsure:
0

#8 User is offline   Mohammad Fareed 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 22
  • Joined: 08-March 14
  • Location:Hyderabad

Posted 22 March 2015 - 09:31 PM

The Date picker is coming fine but Date Format is changing when i change the date

Initially it appearing in 2015-03-11 format late changing to 03/11/2015.

Please provide some alternative solution.
-
With best Regards.
Mohammad Fareed.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users