How to make departure date always after arrival date?

  • huizenijmegen
    Asked on January 17, 2016 at 7:42 AM

    how to prevent wrong dates

  • Mike_G JotForm Support
    Replied on January 17, 2016 at 5:18 PM

    On your form, http://www.jotform.com/60044241786352, I'm seeing Departure Date and Arrival Date fields. When you say wrong dates, are you referring to the dates from the past and you don't want your submitters to accidentally select dates from the past, correct?

    I have checked your form and it seems that you have already made the fields not able to accept past dates.

    If this is not what you are referring to, kindly give us more details about your concern so we can further help you. We will wait for your response. Thank you.

  • huizenijmegen
    Replied on January 17, 2016 at 6:47 PM
    Hi,
    I’ve 2 issues with the dates.
    Since the dates are referring to the beginning and ending of a stay in our B&B
    there are 2 separate demands:
    (1) both dates must be in the future
    and
    (2) the end-date must be AFTER the start-date.
    Now, I know that the first issue is an option that can be ‘checked’ within both fields.
    However, I’ve not figured out how I can make the end-date always later than the start-date.
    I guess I’ve to create separate calculation fields that contain the difference between these two dates as an integer.
    Would that be the way to handle this, or is there another way?
    best,
    Carolus
    B&B Huize Nijmegen,
    The Netherlands
    ...
  • BJoanna
    Replied on January 18, 2016 at 5:11 AM

    Thank you for providing us additional information.

    It is not possible to prevent users to choose End date that is before Start date.

    Possible workaround is to add Form calculation field that will calculate difference between dates and then if calculation is less that 0, you can use conditional logic in your form to hide submit button so your users will not be able to submit your form if End date is before Start date. You can also add text field that will notify your users that End date can not be before Start date.

    1453111411demo1 Screenshot 10

    1453111430demo Screenshot 21

    Instead of hiding submit button field, you can also use Enable/Require field condition and disable submit button. 

    1453111664enable Screenshot 32

    Here is my demo form: https://form.jotform.com/60172652512953 

    Feel free to clone it.

    Hope this will help. Let us know if you need further assistance.

  • huizenijmegen
    Replied on January 18, 2016 at 5:47 AM
    Thank you so much.
    This is exactly what I would like to achieve.
    I’ll try this and implement it in my form
    Regards,
    Lydia Grütters
    B&B Huize Nijmegen
    www.huizenijmegen.nl
    Groesbeekseweg 50
    6524DE Nijmegen
    The Netherlands
    ...
  • Carina
    Replied on January 18, 2016 at 9:33 AM

    On behalf of my colleague you are most welcome.

    Let us know if you need additional support.

  • huizenijmegen
    Replied on January 18, 2016 at 4:47 PM
    Just a remark after implementing your solution using a calculation field.
    Pffff, … I found it.
    The addition of a calculation field is … very well hidden.
    It took me some time to:
    * discover that this is not a regular field but a widget (strange name BTW)
    * which is - by default - NOT shown under the list of widgets
    * and only shown if you “search" for it
    * then it pops out of thin air ...
    and i was confused about
    * the meaning of some “advanced options” of the calculation wizard:
    such as: “wait for input before including the field in calculation”
    This latter option, I presume, is to prevent calculations before the variables are filled.
    OK
    But what then is the value of such a calculation field if not all fields are filled?
    Zero? or is it the pre-populated value? And if so, what happens if this is, say 999?
    Since the contents of a warning are shown if the dates are ‘wrong’, i.e. the departure date
    is BEFORE the arrival date, I’ve difficulties with defining the proper default value of this calculation field.
    Best,
    Carolus
    ...
  • David JotForm Support Manager
    Replied on January 18, 2016 at 9:58 PM

    I don't understand your concern, the forms calculation is working as expected. The fact that the Form Calculation field has a default value does not affect your form's conditional logic.

    If you want to remove a default value, simply click on the gear icon, click on "edit properties", look for "Default Result" and leave it empty:

    How to make departure date always after arrival date? Image 1 Screenshot 20

  • huizenijmegen
    Replied on January 25, 2016 at 12:45 PM
    Hi,
    another question regarding my form.
    I’ve implemented your suggestion on the dates: excellent.
    It works.
    However, the error message does not look the same as the standard error messages.
    The standard error messages are in red.
    How can I realize that my own error message look the same.
    best,
    Carolus

    ...
  • BJoanna
    Replied on January 25, 2016 at 1:58 PM

    Considering that your last question is not related to subject of this thread, I have moved it to separate thread and we will provide you an answer there shortly.

    http://www.jotform.com/answers/755353