Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2008
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need help with my datepicker

    I need some help with my datepicker. I'm using the datepicker tool from this website:
    http://keith-wood.name/datepick.html

    I have two date fields setup with the datepicker and they work together to create a date range.
    the code I'm using for this is right from the website and it work perfectly.

    function customRange(input){
    return{
    minDate: (input.id == 'cmn_enddate' ? $('#cmn_stdate').datepick('getDate') : null),
    maxDate: (input.id == 'cmn_stdate' ? $('#cmn_enddate').datepick('getDate') : null)
    };
    };

    // Add DatePicker
    $('#cmn_stdate').datepick({beforeShow: customRange});
    $('#cmn_enddate').datepick({beforeShow: customRange});


    cmn_stdate is the start date and cmn_enddate is the end date. If a user picks the start date first, then the end date range cannot be selected before the start date. Likewise, if a user picks the end date first, a start date that comes after the end date cannot be chosen. As I said, this is working great.

    However, I want it so that only dates that start two days from today to be selectable. All dates prior to that should be unselectable. This seems to only work if I use the minDate attribute by itself. But then the start/end ranges function doesn't work.

    Any ideas would be most appreciated.

    Thanks.

  • #2
    Regular Coder ohgod's Avatar
    Join Date
    Jun 2008
    Location
    Ohio
    Posts
    579
    Thanks
    6
    Thanked 69 Times in 69 Posts
    for clarification, this is a jquery plugin

  • #3
    New Coder
    Join Date
    Jan 2008
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Never mind. It's not perfect but when I simply replace the first null with +2 it works. Still cannot control the end date exactly the way I'd like but the issue is forced when the start date can only be selected as desired.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •