How to make departure date always after arrival date?

  • Profile Image
    Asked on January 17, 2016 at 07:42 AM

    how to prevent wrong dates

  • Profile Image
    Answered on January 17, 2016 at 05:18 PM

    On your form,, 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.

  • Profile Image
    Answered on January 17, 2016 at 06:47 PM
    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
    (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?
    B&B Huize Nijmegen,
    The Netherlands
  • Profile Image
    Answered on January 18, 2016 at 05: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.



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


    Here is my demo form: 

    Feel free to clone it.

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

  • Profile Image
    Answered on January 18, 2016 at 05: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
    Lydia Grütters
    B&B Huize Nijmegen
    Groesbeekseweg 50
    6524DE Nijmegen
    The Netherlands
  • Profile Image
    Answered on January 18, 2016 at 09:33 AM

    On behalf of my colleague you are most welcome.

    Let us know if you need additional support.

  • Profile Image
    Answered on January 18, 2016 at 04: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.
    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.
  • Profile Image
    Answered on January 18, 2016 at 09: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:

  • Profile Image
    Answered on January 25, 2016 at 12:45 PM
    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.

  • Profile Image
    Answered on January 25, 2016 at 01: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.