How to limit time range?

  • penderparksrec
    Asked on May 14, 2019 at 4:46 PM

    I have a field in my form with time range. I am able to set up a condition that will hide the submit button and give a message if they try to choose a time before 7am. However, I am unable to setup a condition that works for the other part of the time range... the ending time. I want to also be able to hide the submit button and give a message if the second part of the range is after 10pm.

    Being that this is a RANGE of times... I need the condition to work on the "ending" time of the range as well as the "beginning" time of the range.

    For example - if someone tries to set the time range for 6am - 9am... they will get a message that it must be after 7am and the submit button is hidden. But 7am - 9am would work.

    But if they try to set the time range to 9pm - 11pm... they won't get the message and the submit button won't be hidden even though I have the condition setup for "After" 10pm.

    It appears that the condition only reads the time at the "beginning" of the range and not the "ending" of the range.

    Basically, the park hours are 7am - 10pm. You cannot request a time to use space in the park unless it falls within this range.

    Thanks in advance for your help!

     

  • Jed_C
    Replied on May 14, 2019 at 9:02 PM

    1). But if they try to set the time range to 9pm - 11pm... they won't get the message and the submit button won't be hidden even though I have the condition setup for "After" 10pm.

    It won't work unless one of the time in the time range meets the condition. In your example, it still meets the condition of 9pm. It is still in the time range between 7am - 10pm.

    A workaround is to use the Time element and HIDE the Submit button using conditions if the Time element is not in the desired range.

    1. Add a Time element and set the Time Format to 24 HOURS.

    How to limit time range? Image 10

    2. Add a Form Calculation Widget and set it to get the value from the Time field.

    How to limit time range? Image 21

    3. Add a condition to HIDE the Submit button if the Calculation of time is not in the desired range.

    How to limit time range? Image 32

    I have also added a condition to Show a warning message (Text element) if the Calculation of time is not in the desired range.

    How to limit time range? Image 43

    I've applied the method above in a cloned version of your form. You can check it here https://form.jotform.com/91337838101960.

    1557882052time range2 Screenshot 54

    Feel free to clone if you want https://www.jotform.com/help/42-How-to-Clone-an-Existing-Form-from-a-URL.

    Let us know if you have any questions or if you need further assistance.