How can I pre-populate the date picker field?

  • Sol_omon
    Asked on April 10, 2017 at 10:39 AM

    In the old Jotform, I just set it to custom and typed in today+14 for two weeks, but in the new jotform it doesn't allow me to do that. Can anyone please help?

  • David JotForm Support
    Replied on April 10, 2017 at 11:52 AM

    The default date can no longer be set as you stated, however, if you would like to disable dates previous to 14 days in the future, you can set the Start Date to today+14

    How can I pre populate the date picker field? Image 1 Screenshot 20

     

  • Sol_omon
    Replied on April 11, 2017 at 5:11 AM

    So there is no way for me to auto-populate that date to be a specific date 3 weeks from today?

  • Sven
    Replied on April 11, 2017 at 6:18 AM

    You can achieve that by using conditional logic, Please see the demo form I've created for you here:

    https://form.jotformpro.com/71002358954960

     

    To achieve this, I created two date fields, one named as the Start Date, and the one as Action Date. I then created a text field, and called it DatesString (this will hold the string value of the current date). 

    On the first Date field (Start Date), I set the default date to be today's date:

    How can I pre populate the date picker field? Image 1 Screenshot 50

     

    I then created the following condition, to get the string value of today's date, and save it in the DateString field:

    How can I pre populate the date picker field? Image 2 Screenshot 61

     

    Finally, I created the last condition to add 14 days to the current date, as follows:

    How can I pre populate the date picker field? Image 3 Screenshot 72

     

    When you run the form, the result should like this:

    How can I pre populate the date picker field? Image 4 Screenshot 83

     

    Please note that you can hide the Start Date and DateString field, I left them visible to demonstrate how the logic would work. 

    You can clone this form using the following URL:

    https://form.jotformpro.com/71002358954960

     

    And here's how to clone existing forms to your account:

    How to Clone an Existing Form from a URL

     

    Thank you.

  • Sol_omon
    Replied on April 11, 2017 at 7:55 AM

    Sven,

     

    I have followed your directions probably 10 times and keep getting weird numbers in the Datestring field. "datestring17267"

     

    I cannot seem to figure this out and I'm following your directions to a T

  • Sol_omon
    Replied on April 11, 2017 at 8:57 AM

    Sven,

     

    How did you enter the original "datestring" in the "Start Date" condition

  • BJoanna
    Replied on April 11, 2017 at 10:38 AM

    "Datestring" is mathematical function. Inside of this guide you can find how to use Math functions with form calcualtion widget and with conditions.

    Form Calculation - Math Function Reference

    You can also clone and inspect the demo form that my colleage provided you:

    https://form.jotformpro.com/71002358954960 

    How to Clone an Existing Form from a URL

    If you still have issues with your form, please provide us ID of your form. 

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

  • Sol_omon
    Replied on April 12, 2017 at 7:41 AM

    Thank you so much BJoanna! I got it working.