Require 2 date-time fields to be different

  • FWMSH
    Asked on December 20, 2015 at 5:24 AM

    I have two date-time fields on my form, one for a primary date request and another for a secondary / backup date.  For most of my submissions though everyone is just making them the same date.  I setup conditional logic to increment the date on the backup field if they are the same but I'd really like to just display a message and prevent the form from being submitted.  Is there any way to do this?

    Thanks,
    Scott

     

  • Boris
    Replied on December 20, 2015 at 6:09 AM

    Scott, please check if this cloned and modified version of your form is what you are looking for:

    https://form.jotformpro.com/form/53532288846970

    The way that it is set up is by adding 3 more fields to your form, and several conditions. It looks like two DateTime fields can't be compared directly, so conditional logic can't directly check if the two dates and times have the same value.

    For that reason, I have created two Text Box fields, made them hidden by clicking on their gear-shaped icon and selecting Hide Field, and finally created a third Text field that will hold the warning message:

    Require 2 date time fields to be different Image 1 Screenshot 40

    I have then set up conditions for updating field values. I've set it such that value of the first DateTime field gets passed as text to the first Text Box field, and a value of the second DateTime field gets passed as text to the second Text Box field. Please refer to the following image for visual guidance on how to set up the condition:

    Require 2 date time fields to be different Image 2 Screenshot 51

    Finally, I've used a Show/Hide condition that will show the Text field (with our message) and hide the Submit button if the values of the two hidden Text Box fields are the same:

    Require 2 date time fields to be different Image 3 Screenshot 62

    The results of the above described changes is the form I've also linked at the top:

    https://form.jotformpro.com/form/53532288846970 (you can clone it into your account for closer examination; note that the cloned form doesn't have any email notifications set, you may need to set email notifications up again on the cloned form)

    Please let us know if this resolves the issue you were having, or if you need further assistance, and we will be happy to help.

  • FWMSH
    Replied on December 27, 2015 at 1:26 AM

    That just about covers it!  I will clone it and tweak a little more after the holiday, thanks!

  • Boris
    Replied on December 27, 2015 at 5:25 AM

    Thank you for updating us, please do let us know if you hit any snags along the way while setting it up, and we will be happy to help.