shabsta
shabsta

Reputation: 26

Jquery inline Datepicker with form field and restricted date range

I've taken the code posted on this site in order to get the inline datepicker display the selected date in a form field. http://elementdesignllc.com/demos/datepicker_inline.html

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

    $("#datepicker").datepicker({
onSelect: function(dateText, inst) { 
    $("#datepicker_value").val(dateText);
}
    });

    });

When trying to implement the restricted date range the code keeps failing.

<script>
$(function() {
    $( "#datepicker" ).datepicker({ minDate: -20, maxDate: "+1M +10D" });
});
</script>

Any assistance would be appreciated.

Upvotes: 0

Views: 589

Answers (2)

shabsta
shabsta

Reputation: 26

Thanks for the suggestions even though some did not assist. This morning I managed to get it solved Here is the code for others that might be stuck in the same situation

<input id="Range" type="hidden" value="2012/11/10"/ name="newdate">

<script type="text/javascript">
    $(document).ready(function(){
        $("#fromCalendar").datepicker({ altField: "#Range", altFormat: 'yy/mm/dd', minDate: +65, maxDate: "+94D", defaultDate: +64  });
    });
</script>

Upvotes: 1

ews2001
ews2001

Reputation: 2187

Take a look at this example on jsfiddle:

http://jsfiddle.net/4kpWp/3/

In your code you've set up 2 "datepickers" referring to the same ID, I would just use 1 datepicker with the ID #datepicker.

Upvotes: 0

Related Questions