What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    How do I calculate the difference between todays date and a date set in the future that is hidden in the form?

    Asked by ryandonald on March 16, 2015 at 05:07 PM

    I am trying to calculate how many days there are from the day the customer sees my form to 02/11/2015 2nd november which will remain hidden. How can I modify the script to allow me to change and set this date? 

    Cheers

    Ryan

    Page URL:
    http://form.jotform.co/form/50741458971866

    the difference in hidden Day 2015 calculate
  • Profile Image
    JotForm Support

    Answered by jonathan on March 16, 2015 at 07:47 PM

    Hi Ryan,

    If you check this JotForm Calculate Number of Days template, you will see how it calculates the number of days between 2 dates.

    As you can see, it will be simple to calculate the days difference between two dates using the Date field.

    BUT if I am not mistaken, from what I understand on your description, you wanted the future input date to be hidden on the form?

    In your form http://www.jotform.co/form/50741458971866, the user should not be able to manually input the future date?

    Can you please clarify first if my understanding of the procedure is correct.

    We will provide with you with the applicable solution when this is clear.

    Thanks.

     

     

  • Profile Image

    Answered by ryandonald on March 16, 2015 at 08:41 PM

    Yes that is correct, I need the future input date to be hidden

    Awesome thankyou 

  • Profile Image
    JotForm Support

    Answered by jonathan on March 16, 2015 at 10:31 PM

    You can achieve this by following these steps:

    #1. Add a hidden DateTime field on the form.

    #2. Create the needed Calculation between 2 dates.

     

    #3. Make sure first the calculation is working as needed. The fields can be hidden also using the Hide Property

     

     

    --

    the question now is.. how will you be able to fill-in the future dates if it is hidden on the form?

     

    #4. You can pre-fill the hidden Date (future date input) using the pre-populate URL method.

    user guide: -Prepopulating-fields-to-your-JotForm-via-URL-parameters

     

    You can test my demo form. I have hidden the future Date and show only the Total Days so that you can see the calculation. 

    http://www.jotformpro.com/form/50747056708965?futureDate[month]=05&futureDate[day]=23&futureDate[year]=2015

    Hope this help. Let us know if you need further assistance.

    Let us know if this solution work.. or not.

    Thanks.