How can I pre-populate the date picker field?

  • Profile Image
    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?

  • Profile Image
    david
    Answered 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

     

  • Profile Image
    Sol_omon
    Answered on April 11, 2017 at 05:11 AM

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

  • Profile Image
    Sven
    Answered on April 11, 2017 at 06: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:

     

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

     

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

     

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

     

    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.

  • Profile Image
    Sol_omon
    Answered on April 11, 2017 at 07: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

  • Profile Image
    Sol_omon
    Answered on April 11, 2017 at 08:57 AM

    Sven,

     

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

  • Profile Image
    BJoanna
    Answered 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. 

  • Profile Image
    Sol_omon
    Answered on April 12, 2017 at 07:41 AM

    Thank you so much BJoanna! I got it working.