Yeah, I was wanting to avoid the need to write a function......or
freezing the textbox.....to me it seems wierd or inconsistant that the
datepicker won't allow you to pick a date beyond the maxDate, but you
can enter it manually and nothing happens (it should revert back to
the maxDate)......

anyways all good, I guess I'll have to add that functionality myself..
Thanks though

On Aug 26, 11:47 am, rupak mandal <rupakn...@gmail.com> wrote:
> hi,
> you can try this
>
> $("#datepicker").change(function() {
>          var date1=$("#datepicker").val();
>          var myday = new Date(date1);
>          var today=  new Date();
>          var one_day=1000*60*60*24;
>          chan_date=Math.ceil((myday.getTime()-today.getTime())/(one_day));
>
>          var month = myday.getMonth()+1;
>          if(month<10)
>             month="0"+month;
>
>          var dat=myday.getDate();
>          if(dat<10)
>             dat="0"+dat;
>
>     if(chan_date>0)
>
> $("#datepicker").attr("value",month+"/"+dat+"/"+myday.getFullYear())
>       });
>
>  });
>
> but the better option is that restrict the user to enter date manually. Made
> the datepicker text box readonly.
>
> Thanks
> Rupak
>
> On Wed, Aug 26, 2009 at 3:25 AM, sak <saks...@gmail.com> wrote:
>
> > Hi there
>
> > I have a problem with the date picker and was wondering if something
> > had already been developed to sort it out, or whether I would need to
> > do one myself.
>
> > With a datepicker in the webapp we are developing, we want to allow
> > users to view data based on past dates (ie anything from an old date
> > up to present date). So with this in mind I have set the max date on
> > the datepicker like this {maxDate: +0} so users can't pick dates
> > beyond today.
>
> > However if the user manually enters the dates (say beyond the maxDate)
> > then nothing happens. The date input holds the date entered even if it
> > is beyond the maxDate set.
>
> > What I want it to do, is if the users manually types in a date (if
> > that date is beyond the maxDate set) then it should revert back to the
> > maxDate.
>
> > can the datepicker do this?
>
> > Any help will be awesome
> > Thanks
> > Sak

Reply via email to