Default current time and date for use in conditions

  • cheapo
    Asked on June 20, 2018 at 1:22 PM

    Hello...

    I am working on Original Vehicle database we have a dropdown called "schedule" this widget has different dropdown options with different schedules depending on the schedule you select is the extra fee on the time or date.

    I was wondering if you have a widget that we can add to the form so the form can know the time and the day so it can automatically add the correct scheldule on the dropdown.

    I Appreciate a Quick Response Thank You, 

    Robert.

  • David JotForm Support
    Replied on June 20, 2018 at 2:31 PM

    The date picker field can have the default set to the current date/time.  You can use the date in that field to make other selections or update field values conditionally:

    https://www.jotform.com/help/57-Smart-Forms-Using-Conditional-Logic

  • cheapo
    Replied on June 20, 2018 at 2:58 PM

    Thank you for your advice but you didn't give me an example on how to use the widget we have a dropdown on our form that has time window

    example: 

     So we charge a particular price at this time window

    8:00am- 6:00 pm window

    6:01pm - 11:59 pm window 

    12:00 midnight - 7:59am window


    So please give me step by step on how to do the condition logic, I need it to select the appropriate dropdown for the appropriate time.  

    Thanks,

    Robert

  • cheapo
    Replied on June 20, 2018 at 3:11 PM

    So examining your selection of the non widget Date picker i don not want to enter the time i want to understand what time and day it is now on a AM/PM clock just to re-state what we re trying to come across the form will actually understand the time and date so the form will automatically pick the appropriate drop down based on the time and date it is presently.

    Hopefully you understand what we are trying to come across,

    Thanks Robert  

  • Adrian
    Replied on June 20, 2018 at 4:46 PM

    Hi Robert,

    I believe this is the form that you are talking about. https://form.jotform.com/81538401243147

    I can see that there is a dropdown (Schedule) in which the users can pick an option.

    Default current time and date for use in conditions Image 10

    If I understand you correctly, you want that field to be filled automatically based on the current time (and date) when the form is opened.

    This can be done but it requires a bit of work.

    I have cloned your form and implemented one condition for demo purposes.

    Cloned Form URL: https://form.jotform.com/81706239640962

    If the current time is between 08:00 and 18:00, the corresponding option will be pre-filled.

    Default current time and date for use in conditions Image 21

    First, you will have to add the following extra elements on your form.

    1. A Time element.
    - Set it to a 24 Hour Format
    - Set the Default Time to CURRENT
    - Set Read-Only to ON
    - You can also optionally choose to hide the element

    2. Add a Date element on your form
    - Set the Default Date to CURRENT
    - Set Read-Only to ON

    3. Add a Dropdown element for each possible option and set the Selected by Default for each element. These elements can be hidden.

    On my form, I have added only one element for demo purposes only.

    Default current time and date for use in conditions Image 32

    The value of this element will be copied to the dropdown Schedule if the condition is fulfilled.

    Condition:

    Default current time and date for use in conditions Image 43

    On your case, you will have to add much more dropdown elements and conditions so that each time/date frame is covered.

    On my case, the Schedule field will be pre-filled only if the current time is between 08:00 and 18:00.

  • cheapo
    Replied on June 20, 2018 at 6:17 PM

    Excuse me,

    I don't understand the difference pulling down the correct window time frame or putting in the time they both involve human involvement, I was hoping we can do it by a clock so the system will know the time automatically and the correct pull down will be automatically selected.

    We appreciate any suggestions,

    Thanks Robert   


  • jonathan
    Replied on June 20, 2018 at 8:36 PM

    Hi Robert,

    You can also use the Conditions pre-select an option from the Dropdown list.

    Test this form https://www.jotform.com/81707282917968

    It work like this:

    Default current time and date for use in conditions Image 10

    There is a Time field in the form that detect the system time on initial load of the form. Then using Conditions, pre-select the Time option (in Schedules)

    Do take note that it will take a lot of Conditions if there are also a lot of items/options in the Dropdown lists.

    Example conditions:

    1529541330zzz 2018 06 21 08 Screenshot 21


    I hope this help. Let us know if you need further assistance.



  • HendryJAmes
    Replied on June 20, 2018 at 11:28 PM

    Thank you for sharing this information. 

    Even i do not like to have default setting anywhere in my system. That's why i always try to search to replace the default settings. Recently, i found one article about resetting router login default settings. It is a good post, guide me to rest my router.