Hello!
Sorry there is no way in the ui to disable dates but this can be done with a javascript (that can be added in the javascript section of your form). something like this:
rnJQuery('#arrivaldate input').change(function(){
rnJQuery( "#departuredate input” ).datepicker('option', 'minDate', rnJQuery( "#arrivaldate input" ).datepicker("getDate"));
});
that would disable all the dates prior the date of the arrivaldate, to disable all the dates before today you can add this:
rnJQuery( '#arrivaldate input' ).datepicker('option', 'minDate',0);
So in the end your js should look like this :
//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('#arrivaldate input').change(function(){
rnJQuery( "#departuredate input” ).datepicker('option', 'minDate', rnJQuery( "#arrivaldate input" ).datepicker("getDate"));
rnJQuery( '#arrivaldate input' ).datepicker('option', 'minDate',0);
});
});
},
//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;})
Hope this helps but if it doesn’t please let me know!
-
This reply was modified 8 years, 7 months ago by
EDGARROJAS.
Hi Edgar – thank you so much for your reply…
Unfortunately, that doesn’t seem to be working. I may be doing something wrong, as I have no experience with JS, but I can still select dates prior to today, and departure dates prior to the arrival date, and the form submits fine…
When I click Validate underneath the JS box, it tells me:
SyntaxError: Invalid character: ‘#’
I have changed my field names to match the script (arrivaldate and departuredate) as they were previously just ‘arrival’ and ‘departure’ but this has not helped
I’d really appreciate any further help you can offer! Thank you…
Sure, could you send me a link to your form please? I can build the code that you need =).
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( ‘#arrivaldate input’ ).datepicker(‘option’, ‘minDate’,0);
rnJQuery(‘#arrivaldate input’).change(function(){
rnJQuery( ‘#departuredate input’ ).datepicker(‘option’, ‘minDate’, rnJQuery( ‘#arrivaldate 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;})
I think that should do the trick =).
That’s perfect – thank you so much!