Conditions > Dates: Conditionally adding X days not working

  • NormandDegre
    Asked on September 30, 2023 at 1:55 PM

    Hi,

    Every Thursday, I send a JotForm for the people to register for our bridge activiy the following Monday.

    Is there a way to show the following Monday's date into the form, to indicate the date they would be playing?

    Thank you

  • Chris_L JotForm Support
    Replied on September 30, 2023 at 7:21 PM

    Hi Normand,

    Thanks for reaching out to Jotform Support. The user may submit your form on a different day after you sent the form, so it is hard to create a formula that will fill their play date based on the date they submitted your form. The best way I can think of is to add the Date Picker element in your form, set a custom date, and then show the field based on condition set. Let me show you how:

    • In Form Builder, click on the Add Form Element menu on the left side of the page.
    • Under the Basic tab, scroll down to Date Picker. Drag and drop the element to your form. Conditions > Dates:  Conditionally adding X days not working Image 1 Screenshot 70
    • Select the Date Picker and click on the Gear icon to access its Properties.
    • Under the Options tab, select Custom and select the Monday date.Conditions > Dates:  Conditionally adding X days not working Image 2 Screenshot 81
    • Under the Advanced tab, toggle the Read Only and Hide Field switch to On.Conditions > Dates:  Conditionally adding X days not working Image 3 Screenshot 92

    Now, let's set up the conditional logic what will display the Date Picker. Let's do it:

    • Click on the Settings tab in the orange navigation bar at the top of Form Builder.
    • Select Conditions on the left side of the screen.
    • Select Show/Hide Field.
      Conditions > Dates:  Conditionally adding X days not working Image 4 Screenshot 103
    • Set the then set the conditions just like you see below.
      Conditions > Dates:  Conditionally adding X days not working Image 5 Screenshot 114
    • Finally, click on Save.

    Here's a screencast of the expected form behavior:

    Conditions > Dates:  Conditionally adding X days not working Image 6 Screenshot 125

    Reach out again if you need any other help.

  • NormandDegre
    Replied on October 1, 2023 at 4:17 PM

    Thank you.

    I should have added the word "automatically" in the following sentence.

    Is there a way to "automatically" show the following Monday's date into the form, to indicate the date they would be playing?

    If I understand correctly your solution, I would have to modify the form every week to change the date.

    In that case, I simply can add a text (paragraph) field and write the date.

    I would like to show the date of the Monday following the date when they fill out the form.

    Thank you


  • Karlo JotForm Support
    Replied on October 1, 2023 at 5:02 PM

    Hi Normand,

    Thanks for reaching out to Jotform Support. If I understand correctly, you will only send the form every Thursday for people to register for your bridge activity. Is that correct? If so, you can easily use the date string in form calculations to automatically show the date on Monday when they will play in a few easy steps. Let me show you how.

    1. In Form Builder, on the left side of the screen, click on Add Form Element.
    2. Click on Date Picker, go to Widgets, and click on the Form Calculation Widget.

    Conditions > Dates:  Conditionally adding X days not working Image 1 Screenshot 60

    We have to set the date picker to default to current.

    1. In Form Builder, go to your Date Picker and click on the Gear Icon.
    2. Go to Options, and on Default Date, click on Current.

    Conditions > Dates:  Conditionally adding X days not working Image 2 Screenshot 71

    To calculate the date using the form calculation widget, using the date string.

    1. In Form Builder, go to your Form Calculation Widget and click on the Wand Icon.
    2. Click on the Three Horizontal Dots, scroll down, and select dateString().
    3. Click on Add Field, click on Date (your date picker), click on the Plus Sign (+) and the number 4, and finally click on Save.

    Conditions > Dates:  Conditionally adding X days not working Image 3 Screenshot 82

    Here is the calculation in the form calculation widget.

    Conditions > Dates:  Conditionally adding X days not working Image 4 Screenshot 93

    Here is a preview of the cloned form, and for testing purposes only, I have set the date for Thursday.

    Conditions > Dates:  Conditionally adding X days not working Image 5 Screenshot 104

    Here are guides on How to Perform Form Calculation Using a Widget and Form Calculation: Math Function Reference.

    Let us know if there’s anything else we can help you with.

  • NormandDegre
    Replied on October 2, 2023 at 7:42 AM

    Thank you again for trying to help me.

    However, I had not wanted to repeat the sentence written by Chris, above. He wrote: "The user may submit your form on a different day after you sent the form, so it is hard to create a formula that will fill their play date based on the date they submitted your form."

    Therefore the calculation that you are suggesting, only works if they submit the form on the Thursday. Therefore when someone fills out the form on a Friday or Saturday, the date will be incorrect.

    Would you have another suggestion?

    Thank you

  • Chris_L JotForm Support
    Replied on October 2, 2023 at 8:56 AM

    Hi Normand,

    I'm sorry for the confusion. My initial understanding that you will only need to get the next Monday after you sent the form. The first step is to identify what day is the current date (I named it booking date in my demo form). To do this, we will be using Form Calculation widget, we will set this to hidden. We will also need to create a conditional logic. Let me show you how:

    1. In Form Builder, click on the Add Form Element menu on the left side of the page.
    2. Under the Widgets tab, search for Form Calculation. Drag and drop the widget into your form.
      Conditions > Dates:  Conditionally adding X days not working Image 1 Screenshot 60
    3. In the widget Settings that opens on the right-side of the page, set up the operation as shown in the screencast below.
      Conditions > Dates:  Conditionally adding X days not working Image 2 Screenshot 71
    4. Finally, click on Save.

    Next, let's set up the conditional logic. Here's how:

    1. In Form Builder, in the orange navigation bar at the top of the page, click on Settings.
    2. Click on Conditions in the menu on the left side of the page.
    3. Click +Add a New Condition.
      Conditions > Dates:  Conditionally adding X days not working Image 3 Screenshot 82
    4. Select Update/Calculate Field and then set the conditions just like you see below if the user selects Thursday in the booking date.
      Conditions > Dates:  Conditionally adding X days not working Image 4 Screenshot 93The value is 4 because the user filled out the form on Thursday, thus, there are 4 days before the next Monday.
    5. Finally, click on Save.

    Here is a screencast of the form in action:

    Conditions > Dates:  Conditionally adding X days not working Image 5 Screenshot 104

    Here is the link to my demo form. Feel free to test or clone the form to inspect the settings.

    Give it a try and let us know how it goes.

  • NormandDegre
    Replied on October 2, 2023 at 11:05 AM

    Wow... It works well.

    Thank you, very much.

    It's great.

    I really appreciate your outstanding services.

    Thank you again and have a great day

  • NormandDegre
    Replied on October 3, 2023 at 4:30 PM
    You did great
    Thank you
    De : Jotform <noreply>
    Envoyé : October 3, 2023 13:00
    À : info <info>
    Objet : Your ticket has been answered. Tell us how we did!
    [Jotform]<https:>
    View this email in your browser<https:>
    [Autoresponder]
    Support ticket answered:
    How to automatically enter a date?
    Hello NormandDegre,
    Your support ticket "How to automatically enter a date?<https:>" has been answered. If you still need assistance, just reply to this email.
    Click one of the icons below to let us know what you think of our service and how we can improve.
    [icon face 1]<https:>
    [icon face 2]<https:>
    [icon face 3]<https:>
    [icon face 4]<https:>
    [icon face 5]<https:>
    Thank you as always!
    [Jotform Team]
    4 Embarcadero Center, Suite 780, San Francisco CA 94111
    24/7 Support<https:>
    Unsubscribe Thread<https:>
    </https:></https:></https:></https:></https:></https:></https:></https:></https:></https:></info></noreply>...
  • NormandDegre
    Replied on November 1, 2023 at 9:40 AM

    Hi,

    Sorry to bother you again.

    The date calculation worked for a while on my form. However, the calculation is now incorrect and I cannot figure out what is wrong.

    The hidden field "Jour de la semaine" (weekday) does not seem to indicate the day of the week.

    Please help.

    The field "Vous vous enregistrez pour la partie du lundi le:" should indicate the following Monday

    https://www.jotform.com/build/232604175783964

    Thank you

  • Eliza JotForm Support
    Replied on November 1, 2023 at 10:44 AM

    Hi Normand,

    Thanks for getting back to us. I'm really sorry that this is happening. Because of your form's access settings, I can't clone your form to test it on my end.

    Conditions > Dates:  Conditionally adding X days not working Image 1 Screenshot 20But, I've gone ahead and cleared your form caches to see if it would fix the issue. If the issue still persists, please try to remove the Date Calculation that you've set up, and add it again. Can you go ahead and try it again and let us know how it goes? If the same thing happens again, we'll investigate it more to see if we can figure out what's going on.

    Give it a try and let us know how it goes.

  • NormandDegre
    Replied on November 1, 2023 at 3:50 PM

    Thank you

    Since I did not want people to register before the problem was fixed, I had deactivated the form. Sorry.

    I added a text showing the correct date and hid the field with the wrong calculation.

    I was not able to fix it.

    A calculation is made, but I get the Sunday instead of the Monday date.

    Thanks


  • Karlo JotForm Support
    Replied on November 1, 2023 at 4:46 PM

    Hi Normand,

    Thanks for getting back to us. I’m really sorry that this is happening. I cloned your form and tested it to see if I could replicate the issue, but everything was working properly. Check out the screencast below to see my results:

    Conditions > Dates:  Conditionally adding X days not working Image 1 Screenshot 20

    Could you try using a different internet browser or incognito/private mode if it makes a difference? Can you try it again and see how it goes? If you run into the same issue again, let us know, and we'll do some more testing to see what's going on.

    Let us know if there’s anything else we can help you with.

  • NormandDegre
    Replied on November 1, 2023 at 5:52 PM

    Thank you.

    It is very strange. I also created a clone to test various possibilities. I changed the date in the "Date d'enregistrement" field.

    The calculation works for any dates after November 6th, but not for the dates between November first and November 6th. I always get November 5th as the calculation result.

    Original form: https://www.jotform.com/build/232604175783964

    Clone: https://www.jotform.com/build/233046781733963

    Second problem: when I preview the form I get an error message "Incomplete data" . I cleared everything but I still get the message. See picture.How to automatically enter a date? Image 1 Screenshot 20 Screenshot 10

  • Sonnyfer JotForm Support
    Replied on November 1, 2023 at 10:01 PM

    Hi Normand,

    I'm very sorry to hear that. I'll need a bit of time to look into this. I will be back shortly.

  • Sonnyfer JotForm Support
    Replied on November 1, 2023 at 10:20 PM

    Hi Normand,

    Thanks for patiently waiting. I cloned your form and was able to replicate the issue. The Vous vous enregistrez pour la partie du lundi le field does not change regardless of the Date entered on Date d'enregistrement. Check out my screenshot below to see my results:

    Conditions > Dates:  Conditionally adding X days not working Image 1 Screenshot 20

    I created a ticket and escalated this to our Developer team. Although we don't know exactly when the issue will be fixed, we’ll circle back to this thread when we have an update.

    As for your other question, I've moved it to a new thread to avoid confusion. Please wait for my reply here

    Thanks for your patience and understanding, we appreciate it.

  • Erwin Support Team Lead
    Replied on November 2, 2023 at 3:37 AM

    Hi Normand,

    Thank you for reaching out to Jotform Support. There is a better way to build these conditions. I will show you an example.

    These are the conditions I set for a demo form:

    Conditions > Dates:  Conditionally adding X days not working Image 1 Screenshot 30

    If you want to check for a date, you can use IS EQUAL TO DAY state when you build your Update/Calculate Field condition.

    Conditions > Dates:  Conditionally adding X days not working Image 2 Screenshot 41

    You can try this demo form and you can clone it. To clone, you can refer to this guide.

    Give it a try and let us know how it goes.

  • NormandDegre
    Replied on November 2, 2023 at 9:45 AM

    Thank you

    That worked in my cloned form.

    I will modify my original form next week and let you know if I still have an issue.

    Thanks again