Is it possible to hide/unhide fields based on the current date?

  • templesinai
    Asked on July 15, 2016 at 1:08 PM

    I would like to create a ticket sales form that will disable or enable certain elements on or after a specific date. For example, I may allow payment by check as a valid payment option, but after a certain date I would like to disallow that option automatically while still offering the other payment methods I've set up. The form would check for "today's date" and compare that to a key date parameter that I set and present form options accordingly by hiding or unhiding fields to fit my scenario.

    Is this possible? Currently, I get the same results by manually altering the form after the key dates happen. I would like this to happen automatically if it can be done. Thanks!

  • templesinai
    Replied on July 15, 2016 at 1:38 PM

    Nevermind. I think I figured it out. Create a HIDDEN field called TODAY and populate it with today's date and time automatically. Then, write various hide/unhide conditions based on this hidden field. Seems straightforward.

    Are there any issues and/or limitations I should be aware of when trying this? Thanks!

  • Irshad
    Replied on July 15, 2016 at 1:44 PM

    Yes, you are correct. You can achieve the required functionality of show/hide a field according to the Conditional logic

    If you face any issue, or need further assistance, please revert back.

    Thanks.

  • templesinai
    Replied on July 15, 2016 at 3:25 PM

    I DID just run into this issue, though on this same topic. How do you incorporate TIME into the date condition too. I've tried several syntax formats and can't make it recognize TIME on the test form. See the attached image here. I'm trying to make the form change what is displayed not only after a certain date (that's easy) but also after a certain TIME on that day.

    Is it possible to hide/unhide fields based on the current date? Image 1 Screenshot 20

  • Nik_C
    Replied on July 15, 2016 at 7:03 PM

    Unfortunately, the time part of the date/time field is not supported at the moment. You can only make conditions with the date part.

    However, I would suggest you to take a look at the following thread where my colleague has described the workaround he uses so he can use the date and time in conditions.

    He created a separate time field that takes the current time and then he uses the conditions separately for the date part and for the time part.

    Let us know if you need more information.

  • templesinai
    Replied on July 18, 2016 at 12:32 PM

    Hi Nic,

    Actually, another of your colleagues suggested an additional work around that I think will work better for my situation. It can be found at this link http://www.jotform.com/answers/883789-How-do-you-incorporate-TIME-into-the-date-condition and seems to be a pretty nice solution. Thanks for your help anyway. Have a great week!

  • David JotForm Support Manager
    Replied on July 18, 2016 at 1:36 PM

    On behalf of my colleagues, you are welcome! Contact us anytime, we will be glad to assist you.