Applying Conditional Logic Based on Time in Appointment Field

  • prowebsol1
    Asked on April 11, 2025 at 12:27 AM

    Hi JotForm Support Team,

    I’m currently using the Appointment field in my form and would like to apply conditional logic based on the time selected by the user, regardless of the date.

    Specifically, I want to increase the charges or show a different message if the user selects a time after 5:00 PM. However, I couldn’t find a direct way to apply a condition based on time alone (without including the date).

    Is there a way to extract just the time portion from the Appointment field, or apply a condition like:

    If Appointment time is after 5:00 PM → Increase price / show message

    If this isn't directly possible, could you please suggest any workaround (e.g., using another field, splitting date and time, or using widgets)?

    Thank you for your help!

    Applying Conditional Logic Based on Time in Appointment Field Image 1 Screenshot 20

  • Jason JotForm Support
    Replied on April 11, 2025 at 3:29 AM

    Hi prowebsol1,

    Thanks for reaching out to Jotform Support. I understand what you’d like to do, but I’ll need a bit of time to work out a solution. I’ll get back to you shortly.

    Thanks for your patience, we appreciate it.

  • Jason JotForm Support
    Replied on April 11, 2025 at 3:58 AM

    Hi prowebsol1,

    I understand that you want to apply conditional logic based on the time selected in the Appointment field, specifically to increase charges or show a message if the time is after 5:00 PM. Currently, the Appointment field does not allow direct extraction of just the time portion for conditional logic. As a workaround, you can simply put a message above the appointment field that if the appointment time selected is after 5:00 pm, then the price will increase. Take a look at my sample below:

    Applying Conditional Logic Based on Time in Appointment Field Image 1 Screenshot 20

    This way, your form users will be informed right away before they proceed in booking the time slot. I simply used a paragraph element to put the message above the appointment element.

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

  • prowebsol1
    Replied on April 14, 2025 at 6:01 AM

    Jason!

    Then how is possible i increase the charges after 5:00 PM

    give proper solution

    i want to charge 50$ before 5:00 PM and 100$ after the 5:00 PM please do this

  • Rene JotForm Support
    Replied on April 14, 2025 at 8:58 AM

    Hi prowebsol1,

    I’ll need a bit of time to look into this. I’ll get back to you as soon as I can.

    We appreciate your patience while we work on a solution.

  • Rene JotForm Support
    Replied on April 14, 2025 at 4:28 PM

    Hi prowebsol1,

    To achieve your goal, first we need to add a new field (Short Text element) so the values from the Appointment field can be copied onto it. This will then be used to create a condition later to set a specific pricing when the 5:00 PM slot onwards is selected. Let me show you how:

    1. In Form Builder, click on Add Element on the left side of the page.

    2. Under the Basic tab, look for Short Text, and then drag and drop it onto the form below the Appointment field.

    3. Click on the Gear icon on its right to access its settings.

    Applying Conditional Logic Based on Time in Appointment Field Image 1 Screenshot 150 4. In the Short Text Properties window on the right, update the Field Label as needed. For this demo, I named it Date/Time.

    5. Go to the Advanced tab and toggle Read Only, Shrink, and Hide Field to enable all of them.

    Applying Conditional Logic Based on Time in Appointment Field Image 2 Screenshot 161 After that, we'll then add a new field for the calculation value set for any appointments made for 5:00 PM onwards. To simplify the steps, we'll just duplicate the existing field, Total Cost, and modify it based on its use. Here's how to do it:

    1. In Form Builder, using your computer mouse, right-click on the field, Total Cost.

    2. From the list of options that'll show up, select Duplicate.

    3. Click on the duplicated field, and then click on its Gear icon to access its settings.

    4. In the Number Properties window on the right, update the Field Label. In this demo, I named it Total Cost After 5:00 PM.

    Applying Conditional Logic Based on Time in Appointment Field Image 3 Screenshot 172 Now that we're done adding the necessary fields, we can now create the condition for them. Let's start with the Short Text field, Date/Time:

    1. In Form Builder, in the orange navigation bar on top of the page, click on Settings.

    2. In the menu on the left, go to Conditions, and then click on Add Condition.

    3. Select Update/Calculate Field from the options.

    4. Start adding the conditions and once done, click on Save at the bottom of the page.

    Applying Conditional Logic Based on Time in Appointment Field Image 4 Screenshot 183 Since there are multiple options for the time slots, you may need to create a condition for all of them (5:00 PM - 10:00 PM slots), so the condition can work properly. Here are the screenshots for the entire condition created for it, in 2 sections:

    Applying Conditional Logic Based on Time in Appointment Field Image 5 Screenshot 194

    Applying Conditional Logic Based on Time in Appointment Field Image 6 Screenshot 205

    For the condition to charge form users with $50 if the time slot selected is 4:00 PM or earlier, you can create a similar condition, only that the values will be from 5:00 AM - 4:00 PM, the calculated value is 50, and the field summary is Total Cost. Check out the screenshots below:

    Applying Conditional Logic Based on Time in Appointment Field Image 7 Screenshot 216

    Applying Conditional Logic Based on Time in Appointment Field Image 8 Screenshot 227

    Applying Conditional Logic Based on Time in Appointment Field Image 9 Screenshot 238

    Applying Conditional Logic Based on Time in Appointment Field Image 10 Screenshot 249

    If you only need to show the necessary total for a selected time slot, you can show/hide the fields Total Cost and Total Cost After 5:00 PM, depending on the selecting time. That way, form users will only see the necessary information they need to know when filling out your form. Let me show you how:

    1. In the Conditions page, click on Add Condition, and then select Show/Hide Field from the list of options.

    2. Start adding the values for the condition and once done, click on Save at the bottom of the page.

    Applying Conditional Logic Based on Time in Appointment Field Image 11 Screenshot 2510 Same with the condition we first created, you need to add all the time slots after 5:00 PM. Check out the screenshots below for the complete values set for the condition:

    Applying Conditional Logic Based on Time in Appointment Field Image 12 Screenshot 2611

    Applying Conditional Logic Based on Time in Appointment Field Image 13 Screenshot 2712

    Check out the preview below:

    Applying Conditional Logic Based on Time in Appointment Field Image 14 Screenshot 2813 You can check out this cloned form used for this demo so you can try it out. Feel free to clone it if necessary.

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

  • prowebsol1
    Replied on April 15, 2025 at 10:50 PM

    Thank you Rene! It work for me, I am very thankful to you

  • prowebsol1
    Replied on April 15, 2025 at 10:55 PM

    Applying Conditional Logic Based on Time in Appointment Field Image 1 Screenshot 20

    Sir i want to clone your form can you give me the access

  • Kris Ann JotForm Support
    Replied on April 16, 2025 at 5:21 AM

    Hi prowebsol1,

    You should be able to clone Rene's form now.

    Reach out again if there’s anything else we can do for you.

  • prowebsol1
    Replied on April 17, 2025 at 1:57 AM

    Thank you Kris Ann i have done

Your Answer