Date Pickers: Show/Hide Field Condition

  • mcloudsphere
    Asked on September 10, 2024 at 2:01 PM

    Hi,

    I’m currently using two 'Date Pickers' in my form: one for the 'Start Date' and another for the 'End Date'. I would like to set a condition ensuring that the 'End Date' is at least equal to or later than the 'Start Date'. Additionally, I would appreciate guidance on how to display an error message when an 'End Date' earlier than the 'Start Date' is selected.

    Thank you very much for your help!

  • Angelica JotForm Support
    Replied on September 10, 2024 at 2:43 PM

    Hi mcloudsphere,

    Thanks for reaching out to Jotform Support. I’ll need a bit of time to look into this. I’ll get back to you as soon as I can.

    Thanks for your patience, we appreciate it.

  • Angelica JotForm Support
    Replied on September 11, 2024 at 2:21 PM

    Hi mcloudsphere,

    Setting a condition to ensure that the End Date is at least equal to or later than the Start Date is easy. Let me walk you through it, step by step:

    1. First, add a Form Calculation widget to the form:

    a. In Form Builder, click the Add Form Element +.

    b. Go to Widgets tab.

    c. Add/drag the Form Calculation widget.

    d. Then, right click the widget and select Hide. Date Pickers: Show/Hide Field Condition Image 1 Screenshot 80

    2. Set the Form Calculation widget to determine the difference between the Start and End dates like you see below:

    Date Pickers: Show/Hide Field Condition Image 2 Screenshot 91

    3. Add a paragraph field that conveys a message that End Date cannot be Earlier than the Start Date:

    a. In Form Builder, click the Add Form Element +.

    b. Under Basic tab, scroll down then add/drag Paragraph field.

    c. Click the Pencil icon to edit the text and Save.

    d. Then, right click the field and select Hide Date Pickers: Show/Hide Field Condition Image 3 Screenshot 102

    4. Now, let's set up the conditions:

    a. In Form Builder, in the orange navigation bar at the top of the screen, click on Settings.

    b. Click on Conditions on the left side of the screen.

    c. Now, click on Add a New Condition and then click on Show/Hide field. Date Pickers: Show/Hide Field Condition Image 4 Screenshot 113

    d. Set the conditions like you see below:

    Date Pickers: Show/Hide Field Condition Image 5 Screenshot 124

    Date Pickers: Show/Hide Field Condition Image 6 Screenshot 135

    Here's the result and my demo form for your reference:

    Date Pickers: Show/Hide Field Condition Image 7 Screenshot 146

    Give it a try and let us know if you need any help.

  • mcloudsphere
    Replied on September 18, 2024 at 9:41 PM

    Thank you very much! I really appreciate your detailed response and the demo form.

Your Answer