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.
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?
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.
Yes that is correct, I need the future input date to be hidden
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.
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.
Hope this help. Let us know if you need further assistance.
Let us know if this solution work.. or not.