Condition to hide the submit button based on time

  • TCTC_Forms
    Asked on October 18, 2023 at 10:38 AM

    Hello, we have a form used to report students off from school or request an early release from school. The request for early release asks for a date and time for the early release request. All early release requests must be submitted one hour before the requested release time through this form. Our issue is that some parents/guardians will not follow this one-hour rule.

    Is it possible to use the early release date and time field to check that the date and time are at least one hour before the submission time of the form using the update/calculate field options?


    https://form.jotform.com/231993620775162

  • Mary JotForm Support
    Replied on October 18, 2023 at 12:18 PM

    Hello TCTC_Forms,

    Thanks for reaching out to us for help. I tried to check for a way to hide the submit button using time difference calculation. But, I noticed that there are some factors I forgot to weigh in prior to creating a workaround. I'll need to clarify some things on the form first. We can't calculate the time difference between a date picker and time field alone. We can calculate the difference between 2 date pickers or 2 time fields.

    To clarify, the option to stop the submission based on the 1-hour rule is applicable only when the parents or student would choose the Early Dismissal for Absence type? If so, we can't directly calculate the time difference since the fields are different.

    Condition to hide the submit button based on time  Image 1 Screenshot 50

    To be able to calculate the time difference, you can disable the time option for the date picker. You can open the properties by clicking the gear icon, and go to time tab and disable it.

    Condition to hide the submit button based on time  Image 2 Screenshot 61

    Then, add a time field separately for the parents or students to fill out.

    Condition to hide the submit button based on time  Image 3 Screenshot 72

    My next question would be, the 1-hour rule is going to be the difference between the time indicated on the selected date for the early dismissal and the time indicated for the early dismissal time?

    Condition to hide the submit button based on time  Image 4 Screenshot 83

    It seems that when the student or parents would fill out the date and time for the early dismissal, the indicated time is the time they would like to be dismissed. We can easily compute the difference if we have like a fixed time value to compare the dismissal time they'd like to request.

    After we hear back from you, we’ll have a better idea of what’s going on and how to help.

  • TCTC_Forms
    Replied on October 26, 2023 at 8:34 AM

    To clarify, the option to stop the submission based on the 1-hour rule is applicable only when the parents or student would choose the Early Dismissal for Absence type? - YES


    My next question would be, the 1-hour rule is going to be the difference between the time indicated on the selected date for the early dismissal and the time indicated for the early dismissal time? No, the one-hour rule would be the difference between the current time the form is submitted and the time the early dismissal will take place.


    For example, early dismissal is selected, and the time for early dismissal is 1:00 p.m. If a parent submits the form at 12:45 am (not an hour before the dismissal time) the submission will not go through, and the parent will receive a message stating why.


  • Mary JotForm Support
    Replied on October 26, 2023 at 9:21 AM

    Hello TCTC_Forms,

    Thanks for getting back to us. I understand the issue, but I’ll need a bit of time to work out a solution. I’ll get back to you shortly.

    Thanks for your patience and understanding, we appreciate it.

  • TCTC_Forms
    Replied on October 26, 2023 at 9:42 AM

    Thank you for reaching back out so quickly. I look forward to hearing from you in regards to a solution.

  • Mary JotForm Support
    Replied on October 26, 2023 at 10:06 AM

    Hello TCTC_Forms,

    Thanks for patiently waiting. You can prevent the parents from submitting the form if the request for early dismissal time is less than an hour. We'll need to separate the current date and time fields against the early dismissal date and time.

    Condition to hide the submit button based on time  Image 1 Screenshot 80

    Then, we'll add the form calculation widget that will calculate the time difference between the current time and the requested time.

    Condition to hide the submit button based on time  Image 2 Screenshot 91

    Then, add a paragraph field which contains the error message if the requested time is less than 1 hour.

    Condition to hide the submit button based on time  Image 3 Screenshot 102

    Next, set up the condition that will hide the submit button when the request did not meet the 1-hour rule. Here's how to add the conditions.

    • In the Builder page, click Settings.
    • In the left-hand panel, select Conditions.
    • Click the +Add a new condition button.Is there a way to set up the form to auto select an option? Image 3 Screenshot 82 Screenshot 72 Screenshot 113

    Now, let's go over the conditions needed. 

    • This condition will show the fields related to Early Dismissal.
      Condition to hide the submit button based on time  Image 4 Screenshot 124
    • This condition will only show the calculated time difference when both time fields are filled out.
      Condition to hide the submit button based on time  Image 5 Screenshot 135
    • This is the condition that will hide the fields on the form, including the Submit button and will show the error display.Condition to hide the submit button based on time  Image 6 Screenshot 146

    Once everything is set in place. Here's how the form should work. You can check out this cloned form.

    Condition to hide the submit button based on time  Image 7 Screenshot 157

    Give it a try and let us know how it goes.

  • TCTC_Forms
    Replied on June 18, 2024 at 11:47 AM

    Hello, We are in the process of building this form out for production use. I have one question about calculating the time difference between the current time and the requested time. If someone selects a date in the future, such as two days in advance, but the current time field and the requested time field are under an hour apart, this seems to prevent the end user from submitting the field. If someone submits the form and it's under an hour on the same day, the form will need to be rejected, but if it is multiple days in advance, the current time and requested time is within an hour, this is ok. Do you understand?

  • Adrian Besilla JotForm Support
    Replied on June 18, 2024 at 1:00 PM

    Hello TCTC_Forms,

    Can you explain a bit more about what you're trying to implement in your form, so I can get a better idea of what's happening? If you can make a work flow, it will help us to figure out the best workaround we can provide.

    Once we hear back from you, we'll be able to move forward with a solution.

  • TCTC_Forms
    Replied on June 18, 2024 at 1:06 PM

    Hello,


    Have you read through this support thread? This explains what I am trying to achieve.

    https://www.jotform.com/answers/8263361-condition-to-hide-the-submit-button-based-on-time


    The request for early release asks for a date and time for the early release request. All early release requests must be submitted one hour before the requested release time through this form. Our issue is that some parents/guardians will not follow this one-hour rule.

    Is it possible to use the early release date and time field to check that the date and time are at least one hour before the submission time of the form using the update/calculate field options?


    Page URL:https://form.jotform.com/231993620775162

  • Harshad_P JotForm Support
    Replied on June 18, 2024 at 1:51 PM

    Hello TCTC_Forms,

    If someone is filling out the form a couple of days ahead of the cut-off time which is 1 hour before the current time, you can just add a one more IF part in the condition to hide the submit button. This is how the condition will be created, If the difference is 1 and the date is the current date then it will hide the submit button. To do this you will need to add one more date field and set it to the current date as default. Let me show you how:

    1. In Form Builder, click on +Add Form Field.
    2. Add the date picket element to the form.
    3. In the date properties under the option tab, select Current in the default date.
    4. Click on the Advance tab and turn the toggle on for Hide. Condition to hide the submit button based on time  Image 1 Screenshot 30
    Then set up the condition as per the screenshot below.
    Condition to hide the submit button based on time  Image 2 Screenshot 41
    Here is a demo form you can check out. Feel free to clone it in your account to understand the conditions.

    Give it a try and let us know how it goes.

  • TCTC_Forms
    Replied on June 27, 2024 at 7:25 AM

    Hello,

    https://submit.jotform.com/241693990354062

    When someone fills out the form with the current date, the current time is 7:20 a.m., and the user puts in an early dismissal time of 1:00 p.m., the calculation is a negative number (-5.67). This causes an error and will not let a user summit the application even though it is an hour before the requested time. Condition to hide the submit button based on time  Image 1 Screenshot 20

  • Afzal JotForm Support
    Replied on June 27, 2024 at 7:47 AM

    Hi TCTC_Forms,

    I cloned your form and tested it to see if I could replicate the issue, and I ran into the same issue. When I looked at your form, I saw that the calculations wasn't configured correctly. Let me show you how to fix it:

    • Under the Build tab, click on the Gear icon to open Form Calculation Widget Properties
    • Change the calculation from:
    Current time - Time
    • To:
    Time - Current time
    • Finally, click on Save, and you're done.

    Condition to hide the submit button based on time  Image 1 Screenshot 30

    Here's the result:

    Condition to hide the submit button based on time  Image 2 Screenshot 41

    Here's the cloned version of the form that you can test.

    Reach out again if you have any other questions.