• Resolved ataualpa85

    (@ataualpa85)


    I have 2 datepicker on a page (checkin and checkout date).
    Is it possible to add a minDate based on the value of the first datepicker input?
    example:
    First date value = 2017-10-15
    Second calendar must start on 2017-10-18

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author EDGARROJAS

    (@edgarrojas)

    Hello!

    That is possible but require an small javascript implementation (which you can add in the javascript tab). Could you give me a link to your form? Probably i can create that javascript for you =).

    Regards!

    Thread Starter ataualpa85

    (@ataualpa85)

    Hello,
    that would be great!
    Thanks a lot.

    This is the link to form: http://www.lcstrapani.it/prenota/

    Plugin Author EDGARROJAS

    (@edgarrojas)

    Got it, please try adding this to the javascript section of your form:

      //AUTO GENERATED CODE, DO NOT DELETE
    (function(){var javaObject={

    //YOU CAN PUT YOUR CODE BELLOW

    //jQueryFormReference:A jquery reference of the loaded form
    AfterFormLoaded:function(jQueryFormReference){
      rnJQuery(‘#rnField7 input’).change(function(){
    rnJQuery( “#rnField9 input” ).datepicker(‘option’, ‘minDate’, rnJQuery( “#rnField7 input” ).datepicker(“getDate”));
    });
    },

    //jQueryFormReference:A jquery reference of the loaded form
    //formData:An object with the information that is going to be submitted
    BeforeFormSubmit:function(formData,jQueryFormReference){
        //Here you can put code that you want to be executed before the form is submitted
    }

    //MORE AUTO GENERATED CODE, DO NOT DELETE
    }; return javaObject;})    

    This will make the min date of Data Fine be the date selected in Data Inizio.

    Regards!

    Thread Starter ataualpa85

    (@ataualpa85)

    Thanks,
    works like a charm.

    But what if I need to set maxdate=mindate +x days?

    I tryed to add a value without any luck…
    rnJQuery( “#rnField7 input” ).datepicker(“getDate”)+1

    Plugin Author EDGARROJAS

    (@edgarrojas)

    Doing manipulations is unfortunately a lot more complex harder. To add or subtract days in a single line you need to do this:

    new Date(rnJQuery( ‘#rnField7 input’ ).datepicker(‘getDate’).setDate(rnJQuery( ‘#rnField7 input’ ).datepicker(‘getDate’).getDate()+3))

    You can change the +3 for the number of days that you want to add or subtract.

    Hope this helps but if it doesn’t please let me know!

    Thread Starter ataualpa85

    (@ataualpa85)

    It works!

    Thanks a lot!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘minDate with two datepicker’ is closed to new replies.