Yii Framework Forum: Bootstrap Datepicker Disable Previous Dates - Yii Framework Forum

Jump to content

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

Bootstrap Datepicker Disable Previous Dates Bootstrap datepicker disable previous dates

#1 User is offline   Azhar 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 24-September 12

Posted 11 June 2013 - 02:33 AM

Hello,
I want to disable previous dates,
i am Using Bootstrap datepicker.

<?php echo $form->datepickerRow($model,'ScheduleDate',array('prepend'=>'<i class="icon-calendar"></i>')); ?>

Can anyone Please Suggest
0

#2 User is offline   Rockstar@Bhushan 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 19-June 13
  • Location:Pune

Posted 19 June 2013 - 04:19 AM

do this in your form

php code:-

echo $form->textFieldRow($model,'date',array('class'=>'datepicker','name'=>'IncomeDetails[date][]'))


js code:-

var date = new Date();
date.setDate(date.getDate()-1);

$('.datepicker').datepicker({
startDate: date
});

:rolleyes:
0

#3 User is offline   Jose H. Milán 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 28
  • Joined: 21-July 11
  • Location:España

Posted 26 June 2013 - 04:18 AM

Hi,

Try this:

<?php echo $form->datepickerRow($model, 'valid_until',array(
                'label' => false,
                'options'=>array('format' => 'dd/mm/yyyy' , 'startDate'=>date("d-m-Y") ,'weekStart'=> 1),
                'placeholder' => 'Valid Until',
                'prepend' => '<i class="icon-calendar"></i>')); 
             ?>


It should disabled past dates on your cal.

Enjoy!
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