Date Reservation: an option in the widget to set a Minimum and a Maximum number of days required

  • Dtbzz
    Asked on May 21, 2019 at 1:07 PM

    Hi,

    How can I get the number of dates that somebody who filled my form has selected?

    I need it to test whether the required number of days was indeed selected (and display an error message if not).

    E.g. I need them to select EXACTLY 4 days. The standard option of the Date Reservation widget only gives the MAXIMUM number of days that can be selected. If I enter "4" in that field, a user can still select only 3 days, without getting a warning.


  • Mike_G JotForm Support
    Replied on May 21, 2019 at 2:55 PM

    We would like to apologize for any inconvenience. I'm afraid we do not have an available workaround to count the number of selected dates in a Date Reservation widget nor set a minimum number of dates that should be selected.

    I can submit a feature request on your behalf, however, I cannot guarantee that it will be implemented any time soon. Feel free to contact us again if you have other questions.

  • Dtbzz
    Replied on May 29, 2019 at 6:01 AM

    I found a workaround to "force" a user to select a minimum of days or and exact number of days.

    By executing the following steps, you can either set a "range" of possible days (e.g. 3 to 5) a user can select, or an exact number of days (e.g. 4).

    1/You keep the Date Reservation Widget and fill out the maximum amount of days your user should be able to select.

    2/You create a first form calculation field (e.g. named "dates") with the input from the reservation widget

    3/You create a second form calculation field (e.g. named "value") with the formula abs(dates)

    4/In the form preview, you click the first possible combination of the MINIMUM number of days you want your user to select.

    E.g.: You want your user to select EXACTLY 4 dates and you only allow dates in the future, today not included. Today is, let's say, June 3, 2019. The first possible combination of 4 days would therefore be, June 4+5+6+7. 

    E.g.: You want your user to select between 3 and 5 days and you only allow dates in the future, today not included. Today is, let's say, June 3, 2019. The first possible combination of your required minimum of 3 days would therefore be, June 4+5+6. 

    5/When you select these dates, the "value"-field comes up with a certain number, e.g. 20803. Note this number down. The number you will need later on is 20803 - 1 = 20802

    6/Close the preview and go back to the builder.

    7/Create a text field (e.g. named "error") including the error message you want your users to see, e.g. "Please select exactly 4 days" or "Please select 3 to 5 days".

    8/Make the fields "dates" and "value" hidden

    9/Go to settings tab and add a condition. Select "Show/hide field" and fill it with the following information

    IF "value" - STATUS "is smaller than" - VALUE "20802"

    DO "show" - FIELD "error"

    If you want to make this "waterproof" you can make the question obligatory and even add the option to hide the "next" button, so your user can not go to the next page unless they have selected the correct number of dates. (only applicable if there is of course a page following directly after your Date Reservation widget). 

    To hide the "next" button, go to the condition described above and next to the DO/FIELD part, click on the "+".

    Do "hide" - Field "xx. Page break" (where xx is the number of the page break following the Date Reservation). 

    You have now set a way in which your users are obliged to select the minimum number of days you have determined. They will not be able to select more than the maximum amount of days as this is controlled by the widget itself.


    I still have to look into a way of counting the number of selected days, as selecting the first 4 possible days or 4 days somewhere a year ahead, results in a very different number. Same for 3 days, 2 days etc. I haven't found the "algorithm" determining the values resulting from these combinations. If anybody finds a workaround for this, please let me know!

  • Welvin Support Team Lead
    Replied on May 29, 2019 at 9:23 AM

    I'm sorry, but I found no workaround for this form. I tried your method and trying to combine it with regular date picker fields, but I cannot seem to get it to work.

    I decided to send this thread to our backend team as a feature request to set a minimum and a maximum number of days in the Date Reservation widget. Unfortunately, we cannot provide you an estimate as to when this feature will get implemented or if our developers will consider adding this in the future, but as soon as we have an update, we will let you know through this thread. 

  • Dtbzz
    Replied on May 29, 2019 at 9:24 AM

    Ok, thanks!

  • Dtbzz
    Replied on June 11, 2019 at 5:40 AM

    Is there by any chance already some more news regarding this topic?

  • jherwin
    Replied on June 11, 2019 at 5:57 AM

    Unfortunately, we have not yet received any updates about this feature request. Once we have any information in this regard, you'll be posted here.

    Thank you :)

  • Dtbzz
    Replied on June 12, 2019 at 5:45 AM

    My proposed workaround isn't that great. However, I tried using the substring function now to extract the dates (one by one) from the text field that gets filled by the dates selected in the Date Reservation widget. By adding the condition that the error field gets displayed when not all of these strings are filled, works :).

  • jherwin
    Replied on June 12, 2019 at 7:56 AM

    That's a nice workaround you've come up with. We will take note of this so that in case other users need this then we can recommend your workaround.

    Thank you for sharing your ideas :)

  • Dtbzz
    Replied on June 12, 2019 at 7:58 AM

    It also works to then (through zapier) add the dates to google calendar (using the filled fields when the users send in their answers :). 

  • jherwin
    Replied on June 12, 2019 at 9:10 AM

    Really? I should try it out and see If I can further improve your workaround. Again, thanks for sharing your idea with us :)

  • Dtbzz
    Replied on June 12, 2019 at 9:35 AM

    I now have another problem: I need to check whether the picked dates are at least 28 days after today (today+28). The calculator widget offers the DateString() formula to convert a TimeDate value into a DateString. I would now need a function doing the opposite: the strings I get (from the datepicker --> textfield --> substring) results in a format like this: dd-mm-jjjj. I now need a way of making Jotform recognise this "text" as a date. Any idea on how to do this?

     

  • Ashwin JotForm Support
    Replied on June 12, 2019 at 11:48 AM

    Why you want to convert and read the string as date?

    You already have selected date in the date field right? I would suggest you to add a "Form Calculation" widget where you can add the formula to read the selected date and add 28 in the value. This will give you the date (selected date+28). You can then add a condition in form to check if the selected date is greater than the (selected date+28).

    Hope this helps.

    Do try it out and get back to us if you have any questions.

  • Dtbzz
    Replied on June 12, 2019 at 12:21 PM

    Jotform wasn't reading the dd-mm-jjjj as a date. When putting the format of both the Date Reservation and the Date Picker widget to mm/dd/jjjj it works.

  • roneet
    Replied on June 12, 2019 at 2:09 PM

    Thanks for lettings us know that it worked.

    Do share with us if you have further concerns.

    Thanks.