How to limit the time showing in a DataTime field?

  • paracaidismogalicia
    Asked on June 7, 2016 at 3:56 PM

    Can I Limit Time?? I want time to display from 10:00 until 18:00.

    Is possible?

  • Mike_G JotForm Support
    Replied on June 7, 2016 at 5:32 PM

    Yes, it is possible. With the help of CSS codes, we will hide the options from 0:00 to 9:00 and 19:00 to 23:00.

    Please check this form: https://form.jotform.com/61586587235972

    Here's the CSS code added to the form.

    select[id^="hour"].time-dropdown.form-dropdown option:nth-child(n+2):nth-child(-n+11){

    display: none !important;

    }

    select[id^="hour"].time-dropdown.form-dropdown option:nth-child(n+21):nth-child(-n+25){

    display: none !important;

    }

    Here's how it's done.

     

    How-to-Inject-Custom-CSS-Codes

    How to limit the time showing in a DataTime field? Image 1 Screenshot 20

    I hope this helps. Let us know if you need any further assistance. Thank you.

  • martinliu
    Replied on December 5, 2016 at 3:17 PM

    Hi Mike_G,

    You CSS code works well with Chrome.  but the hours limitation with your CSS doesn't work in Internet Explorer.  Could you provide the CSS for Interner Explorer as well?

     

    My form: https://www.jotform.ca/form/61805317661253?preview=true

    Thanks,

    Martin

  • Support_Management Jotform Support
    Replied on December 5, 2016 at 5:37 PM

    Hey Martin, to give way to the OP, I have moved your question to a separate thread https://www.jotform.com/answers/1004236

    We'll have it addressed there shortly.