How to autofill "CONTRACT PERIOD" field?

  • neoranking
    Asked on May 27, 2016 at 5:51 AM

    How to auto filled the "Contact Period" field by the values entered from "Start Date" and "End Date"? like this format ->

    "Start Date - End Date" or "Start Date" to "End Date".

     

    I'm trying to do it with Conditional Logic but the values are not displaying in Contract Period Field.

    I hope you can help me thanks! (please see screenshot)

    Jotform Thread 848415 Screenshot
  • Carina
    Replied on May 27, 2016 at 6:26 AM

    1. Add 2 Date Time fields:

    How to autofill CONTRACT PERIOD field? Image 1 Screenshot 40

    2. Please add 2 form calculation fields, one for each date field. Add the correspondent date field to the calculation formula.

    Double click on the red square area to activate the text option:

    How to autofill CONTRACT PERIOD field? Image 2 Screenshot 51

    Repeat this process for both date fields.

    3. Add a 3rd form calculation. To the formula add the start date calculation, add the text "to" , add the end date calculation field:

     

    How to autofill CONTRACT PERIOD field? Image 3 Screenshot 62

    You can test and clone the demo form:

    https://form.jotform.com/61472782620961 

    Let us know if we can assist you further.   

  • neoranking
    Replied on May 27, 2016 at 7:59 AM

    Hi thanks for the solution!!

  • beril JotForm UI Developer
    Replied on May 27, 2016 at 8:35 AM

    On behalf of my colleague, you're most welcome. Feel free to contact us anytime.

  • neoranking
    Replied on June 13, 2016 at 12:19 AM

    Hi,

    Is it possible to have the "CONTRACT PERIOD:" field value to months?

    For example:
    If I enter 13/6/16 to 13/9/16. It should calculate as 3 months for the contract period.

  • beril JotForm UI Developer
    Replied on June 13, 2016 at 2:55 AM

    Yes, it is possible to calculate the number of dates between two days. All you need to do is subtracting two dates with your calculation field as you see below:

    How to autofill CONTRACT PERIOD field? Image 1 Screenshot 30

     

    Here is how it works:

    How to autofill CONTRACT PERIOD field? Image 2 Screenshot 41

     

    If you have any question or issues, please do not hesitate contacting us. We will be glad to assist you.

  • neoranking
    Replied on June 13, 2016 at 4:57 AM

    Thanks for that wonderful solution. Is it possible to say like "2 Months" or "2 Days" or "2 Years"?

  • beril JotForm UI Developer
    Replied on June 13, 2016 at 6:18 AM

    You're most welcome.=) Yes it should be possible with JotForm. To do that, we need to add different calculation field on your form. I will try to find how to do it on your cloned form. After that, I will get back to you soon with a solution as soon as possible.

  • neoranking
    Replied on June 13, 2016 at 7:07 AM

    Thanks Beril!

  • beril JotForm UI Developer
    Replied on June 13, 2016 at 9:39 AM

    Hi again,

    Finally, I am able to manage your problem.=) First of all, I've added the calculation field as you see below:

    How to autofill CONTRACT PERIOD field? Image 1 Screenshot 80

    By that way, we will calculate days, months and years. After that, I've added three calculation fields on your form as you see below:

    How to autofill CONTRACT PERIOD field? Image 2 Screenshot 91

    I've calculated the days, months and years value ass you see below: 

    Days value:

    How to autofill CONTRACT PERIOD field? Image 3 Screenshot 102

    Months value:

    How to autofill CONTRACT PERIOD field? Image 4 Screenshot 113

    Years value:

    How to autofill CONTRACT PERIOD field? Image 5 Screenshot 124

    Now, we will hide month and year if the calculation is less than 1. We will hide day and year if the calculation is less than 12 and greater than 1. And finally, we will hide month and day if the calculation is greater than 12.

    How to autofill CONTRACT PERIOD field? Image 6 Screenshot 135

    However, I am not able to hide days and I am not sure why it is happening. 

    Here is how it works:

    How to autofill CONTRACT PERIOD field? Image 7 Screenshot 146

    I will try to solve that issue. If I solve that I will update you via that thread. Kindly, also check your demo form. Here is your cloned form:

    https://form.jotform.com/61640913986969

    Feel free to clone it. We would appreciate it if you could also test it on your side and let us know the result.

  • neoranking
    Replied on June 14, 2016 at 12:31 AM

    Thanks, I will try this on my form. PLease let me know if you resolve the "Days" Issue.

    Many thanks!

  • jonathan
    Replied on June 14, 2016 at 12:39 AM

    Please don't hesitate to contact us again anytime should you require further assistance.

    Thank you.

  • neoranking
    Replied on June 14, 2016 at 4:38 AM

    Hi,

    I tried to clone the form, but as you can see here - http://www.ashtree.com.sg/airportpass/ the PeriodDays, PeriodMonths and PeriodYears are showing.

  • neoranking
    Replied on June 14, 2016 at 4:39 AM

    PeriodMonths is also not working properly.

  • liyam
    Replied on June 14, 2016 at 7:06 AM

    Hello neoranking,

    Can you try embedding the form using iframe embed code instead of javascript? It appears that it's conflicting with the other form and other scripts on your page.

    Please let us know if the problem persists after the change.

    Thanks.

  • neoranking
    Replied on June 14, 2016 at 8:05 AM

    I tried, but its still not working Liyam.


    http://www.ashtree.com.sg/airportpass/

  • jonathan
    Replied on June 14, 2016 at 9:31 AM

    Can you also take a screenshot of the problem? You can share to us a visual of the issue so we can understand more about it. You can upload the screenshot image when you respond using this link https://www.jotform.com/answers/848415

    --

    I test it on your website http://www.ashtree.com.sg/airportpass/  but I could not replicate the issue so far. See the video below of my test.

    How to autofill CONTRACT PERIOD field? Image 1 Screenshot 20

     

     

    We will wait for your updated response.

     

     

  • neoranking
    Replied on June 14, 2016 at 9:52 AM

    How to autofill CONTRACT PERIOD field? Image 1 Screenshot 20

    Please see attached image. As you can see I have put a date June 16, 2016 as Start Date and July 16, 2016 as End Date. As a result it should give me a "Contract Period" of 1 Month right? Also, all calculations must be hidden and will be displayed upon inputting start date & end date.

    Thanks a lot.

  • liyam
    Replied on June 14, 2016 at 12:00 PM

    Hello,

    Can you try clearing your browser's cache? So far this is how it works on my view on your webpage:

    How to autofill CONTRACT PERIOD field? Image 1 Screenshot 20

    If the problem persists after clearing your browser's cache, please do let us know.

    Thanks.

  • neoranking
    Replied on June 14, 2016 at 10:45 PM

    Hi Liyam,

    There's no problem with days. Try month like June 21, 2016 - July 21, 2016. You will see the issue. It should show 1 month but its not working.

    Best regards.

  • Chriistian Jotform Support
    Replied on June 15, 2016 at 1:32 AM

    I checked the conditions in your form and it seems that the issue is caused due to the value 1 not being included in the condition. Since the condition is set to "greater than 1" but the exact month is only equal to 1, the proper calculation in the condition is not being applied. To resolve the issue, please replace the greater than "1" conditions into greater than "0.99".

    How to autofill CONTRACT PERIOD field? Image 1 Screenshot 30Once you have replaced all the conditions with the value 1 into 0.99, the condition should now work correctly. Here's a demo form so you can see it in action: https://form.jotform.com/61660509575966 

    How to autofill CONTRACT PERIOD field? Image 2 Screenshot 41

  • neoranking
    Replied on June 15, 2016 at 1:51 AM

    It's working now thanks for that Chriistian! Can you see what's the problem why the "CONTRACT PERIODdays" is not hiding while other are working properly?

  • beril JotForm UI Developer
    Replied on June 15, 2016 at 3:28 AM

    Hello,

    Finally, I found the issue.=) It seems there is an old condition which causes that problem. If we disable that it is working properly.

    How to autofill CONTRACT PERIOD field? Image 1 Screenshot 20

    Please also test it on your side and let us know the result. If you notice any issue, please do let us know. We will be happy to help you.

  • neoranking
    Replied on June 15, 2016 at 10:22 PM

    Aweseome, thanks Beril!! :)