dschuett -1 Junior Poster

I have a form that auto-populates an "original date" field based on the previous field that is filled in. What I am looking to do is the following:

Once the "original date" is auto-populated (in the format of 04/09/2012), I need the next field "new date" to automatically have a datepicker function bound to it that does the following:

  1. Uses the date from the "original date" field as the defaultDate.
  2. Disable all date prior to the defaultDate.
  3. Only allow dates that are greater or equal to 23 days from the defaultDate.

I have tried testing with the following with no avail:

org date:<br>
<input type="text" id="intorgDate" /><br>
new date:<br>
<input type="text" id="intnewDate" /><br>

$(document).ready(function() {
    $("#intorgDate").change(function() {
        var myDate = $("#intorgDate").val();
        $('#intnewDate').datepicker({
            inline: true,
            dateFormat: "mm/dd/yy",
            changeFirstDay: false,
            minDate:0,                    
            defaultDate:myDate
        });
    });
});

You can see the fiddle here: http://jsfiddle.net/eQRqt/

I'm thinking that I could use .change() on the "original date" field to trigger a function that dynamically builds the datepcker function and binds it to the "new date" field.

I know that I am probably asking quite a bit. I am still very new to jquery, and haven't ever really worked with datepicker too much let alone trying to customize it to this extent.

Any help is appreciated!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.