JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.
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.
Is there any way to limit a date field to a specific set of dates?Asked by wiltshs on October 12, 2015 at 08:35 AM
Is there any way to limit a date field to a specific set of dates based on a day of the week? For example, I want my form filler to specify a day of the week (Monday etc) and then based on that, have to pick days that are only Mondays, from say the last 8 weeks and the next 2, giving them a choice of 10 actual dates to pick from, and excluding other dates that don't match the day of the week. That would be AWESOME! It does not have to use an actual date field or calendar - if there is logic that would allow me to simply create a dynamic drop down list of valid dates based on the criteria above (day, and weeks back and ahead) then that would be even better.
Unfortunately, this is not currently possible.
You can limit the dates on a calendar by specifying them as mentioned in this guide: http://www.jotform.com/help/337-How-to-Use-the-Limit-Dates-feature-in-a-DateTime-field. But this is not possible by conditionally limiting it based from an input.
This, however, is possible by a different approach. Here's a sample form that I made: https://form.jotform.com/52844752281964?. What my form does is that it identifies if the day selected matched the selected day in the date field. This is the anatomy of my form:
1. First, we setup a drop down for the "Day" selection and a "Date Calendar" field.
2. I will setup a form calculation widget, what it does is it will convert the value on the date calendar to a text string like this one "Mon Oct 12 2015".
Here we will use the "DateString" function and captures or fetch the "Date" field from the calendar.
3. Now we will use the "Text" field to compose our warning or error message
4. I will then use conditional logic to show the error message and hide the submit button. This is how my condition works:
IF "Converted Date String" Contains "Mon"
IF "Day" selected is Equal To "Monday"
Show "Submit" button
Hide the text field with the warning message.
Do the same with the other dates.
I hope that helps. Do let us know if that works.