How can I set the date time tool to display a future date?

  • Profile Image
    trafficstop
    Asked on January 03, 2014 at 02:22 PM

    I have a form that needs to show a deadline, rather than have our reps select the date manually on the form I'd rather the date just be displayed automatically. The deadline would always be 2 days from the date the form is submitted. Is this possible? 
    It doesn't necessarily need to utilize the date time tool either, it can be static text that cannot be changed by the rep. 

  • Profile Image
    EltonCris
    Answered on January 03, 2014 at 03:53 PM

    Hi,

    Unfortunately, that's not possible with the calendar tool in the form builder. However, this is doable when you take your form source code and fo further customization. You can inject custom script on your form source code that adds +2 days on the current day and even make the calendar field not clickable so it can't be edited.

    I will provide you the script with example later today. Stay tuned!

  • Profile Image
    trafficstop
    Answered on January 06, 2014 at 11:34 AM

    Any update on the script?

  • Profile Image
    EltonCris
    Answered on January 06, 2014 at 12:16 PM

    @trafficstop 

    I am truly sorry, I wasn't around for 2 days. I will make sure it'll be available today.

    Stay tuned!

  • Profile Image
    EltonCris
    Answered on January 06, 2014 at 12:24 PM

    By the way, can you please confirm if this is the form you're going to apply the script? http://www.jotform.co/form/33536356017857. Take note that the script works specifically on this form (if this is the correct one).

    We'll await your reply. Thanks!

  • Profile Image
    trafficstop
    Answered on January 06, 2014 at 12:26 PM

    Not a problem, & yes that is the form I will need the script for, thank you!

  • Profile Image
    EltonCris
    Answered on January 06, 2014 at 10:56 PM

    Hi,

    Here's the script. http://pastiebin.com/52cb789927553

    Please take your form source code and paste that script under it. After that, you can embed the joined script all together on your page, or you can save it as html file and upload it on your server.

    Sample result: (I have added comments on the script so you can easily identify where to add number of days)

    Let us know if you need further assistance.

    Regards!

  • Profile Image
    ceu.csupomona
    Answered on June 04, 2014 at 01:43 PM

    I would like to use this on my form. Do I just copy and paste your script under my embed code? I changed the date id to match my id on your code. But I am not sure where to paste your code. I tried to paste it after the embed code but that didnt work.
  • Profile Image
    veritascredit
    Answered on October 21, 2014 at 09:56 PM

    The new thread link is not working. would it be possible to have these instructions from the above functionality of a future date be posted again.

     

    Thank you


    Glen

  • Profile Image
    ashwin_d
    Answered on October 22, 2014 at 08:18 AM

    Hello Glen,

    The thread you are trying to access is actually a private thread and that is the reason why you are unable to open it. 

    If you check the message by my colleague above on this thread only, the complete information is already provide with the custom script code. It would require few changes but it will work for your form too.

    Do check and get back to us if you have any questions.

    Thank you!

  • Profile Image
    veritascredit
    Answered on October 22, 2014 at 12:43 PM

    I've taken my test form with date and added the source code to my webpage in addition to the source code I have also added custom code after the for source code.

    In the custom code I've changed the "getelementbyid" to my form id's for the day month and year. Where the "daystoadd" command is I have typed in 365 as I want the calendar to show an expiration date of 1 year.

    I have published the form online, but there is no change in the date. Can someone share with me where I went wrong?

    here is my test published test calendar

    Glen

  • Profile Image
    Mike_T
    Answered on October 22, 2014 at 03:45 PM

    @Veritascredit,

    Elton's solution requires disabled default time. Please disable a Default Time option on your DateTime field, then get the fresh form source code and use it on your page.

    Thank you.

  • Profile Image
    veritascredit
    Answered on October 22, 2014 at 05:00 PM

    Hi Mike,

    I did as you instructed, but the only change is that the date fields are now empty.

    I also cleared the browser cache.

    any other thoughts?

     

    Glen

  • Profile Image
    Mike_T
    Answered on October 22, 2014 at 06:14 PM

    Do you use a fresh form source on your web page?

    I have cloned your form, added the form source code and script from your page, and it worked well:

    https://shots.jotform.com/mike/examples/date.html