views:

285

answers:

1

Hi there, i have looked around before posting my question

following what i am looking in my datepicker (start date and end date):

1) Start date: can be any date, (user can select start date current (now) to any future date.

2) Start date: user can select start date as back as 6 months. example: if today is 04/22/2010 then i can go back up to 11/22/2009 but not more than 6 moths.

3) Start date if the user select the start date (current of future, not past) less then 10 days then i would like to alert message saying "need at least 10 days"

4) End date: should be current date to future dates alll previous dates are disabled.

5) *Start date / End date: * should not be greater than one year.

Thanks so much.

PS: not sure if i am asking too much here :)

A: 

I answered a similar question for a friend. He needed a cascading date similar, but I think you can see how to solve the issue if you look at my markup.

HTML

  <form target="_self" action="ClearForm.aspx">
Clear Form
  • Start Date:
  • End Date:
  • Clear

JS

<script type="text/javascript">
$(document).ready(function () {

  $('#endDate').datepicker({ showOn: 'button',
      buttonImage: '../images/Calendar.png',
      buttonImageOnly: true, onSelect: function () { },
      onClose: function () { $(this).focus(); }
    });


  $('#startDate').datepicker({ showOn: 'button',
      buttonImage: '../images/Calendar.png',
      buttonImageOnly: true, onSelect:
        function (dateText, inst) {
          $('#endDate').datepicker("option", 'minDate', new Date(dateText));
        }
      ,
      onClose: function () { $(this).focus(); }
    });


});             

Chris Love
@Chris, i have removed dateText and it works what i want which means i have done with #4
Abu Hamzah