How to disable dates dynamically?

  • amirw1962
    Asked on April 2, 2018 at 1:38 AM

    Hello,

    I have 2 dates fields:

    Start date

    Expiration date.

    I want to limit the values in expiration date field based on values in start date field.

    I understand I can limit the values in expiration date field in terms of absolute values, but I need to limit the values dynamically, based on the values the user typed into start date field.

    Actually I want to limit the values in expiration date field to a future date, after the day entered into start date field.
    I have no idea what the start date value is so I can't enter absolute value in expiration date field. I need to check start date value entered by user, first.

    In order to avoid mistakes, I want to prevent the user from typing in expiration date field a date which is earlier than in the start date field, something like:
    expiration date > start date.

    Shortly, I'd like to use a variable in the limits, not absolute terms.

    Is it possible?

    In general, from time to time we want to limit one field, based on values in another field.
    For example, in my insurance form, if somebody tells me in action field (a dropdown list of requested actions) he wants to cancel the insurance, I want to make sure the comments field is not left blank, without providing a reason to "cancellation" in action field.

    Is it possible?

    Best Regards,

    Amir


  • Nik_C
    Replied on April 2, 2018 at 4:21 AM

    These are available limits for the Date field:

    1522656927Screen Shot 2018 04 02 at 10 Screenshot 10  1522656937Screen Shot 2018 04 02 at 10 Screenshot 21

    You can restrict future/past dates, a day of the week or specified dates and date ranges.

    What you can do as well is to set start and end dates dynamically:

    1522657178Screen Shot 2018 04 02 at 10 Screenshot 32

    And this is how it works:

    1522657247Screen Shot 2018 04 02 at 10 Screenshot 43

    But, there is no option to disable certain dates in date field based on dates in another date field, if that is what you had in mind?