How to disable the already selected date for next date box in J.T.Sage DateBox

拜拜、爱过 提交于 2019-12-02 08:38:37

问题


I my application i use jt.sage DateBox. I want to disable the already selected datepicker for next date box fields for example my Date1 is like 13.08.14 my other date box fields need to select after 13.08.14 (NOTE : depends on previous date fields).

Here is the FIDDLE FOR date box demo.

It has lot of options like prevent tomorrow and yesterday day but not include after select the current date

        <label for="mydate">Date 1</label>
        <input  id="date1" type="date" data-role="datebox" data-options='{"mode": "datebox", "useNewStyle":true}' onclick="filterDate(this.id);"/>
        <label for="mydate">Date 2</label>
        <input  id="date2" type="date" data-role="datebox" data-options='{"mode": "datebox", "useNewStyle":true}' onclick="filterDate(this.id);"/>
        <label for="mydate">Date 3</label>
        <input  id="date3" type="date" data-role="datebox" data-options='{"mode": "datebox", "useNewStyle":true}' onclick="filterDate(this.id);"/>
        <label for="mydate">Date 4</label>
        <input  id="date4" type="date" data-role="datebox" data-options='{"mode": "datebox", "useNewStyle":true}' onclick="filterDate(this.id);"/>
        <label for="mydate">Date 5</label>
        <input  id="date5" type="date" data-role="datebox" data-options='{"mode": "datebox", "useNewStyle":true}' onclick="filterDate(this.id);"/>

How to do this please help to solve this one.


回答1:


Hope this helps you : http://jsfiddle.net/QTuma/52/

Just change in the logic for difference calculation:

Start Date
// Get the difference
          var diff = parseInt((((startDate.getTime() - todaysDate.getTime()) / lengthOfDay)+2)*-1,10); 

And End Date

 // Get the difference
          var diff = parseInt((((endDate.getTime() - todaysDate.getTime()) / lengthOfDay)),10); 

This will work for the statement 'example my start date is like 13.08.14 my end date box fields need to select after 13.08.14 .'



回答2:


I have updated your code based on below reference,

http://jsfiddle.net/ktbcP/528/

This should solve your issue,

http://dev.jtsage.com/jQM-DateBox/doc/6-2-link/

Hope it helps !!



来源:https://stackoverflow.com/questions/25280308/how-to-disable-the-already-selected-date-for-next-date-box-in-j-t-sage-datebox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!