πDate picker
Add a date picker using an Open Text question
A datepicker is a widget that allows you to save dates using a calendar. In order to apply this code correctly, you must follow the next steps:
Add an open text question in the page you want to add the datepicker.

Then, you must change the question to not required in order to allow this script to make custom validations.

Open the Javascript editor, paste the code below this image and click the Save button.

How to use it...
The open text question will be hidden and a datepicker will be placed. All the dates that you select in the datepicker will be saved into the hidden open text question to allow SynoSurvey to save the data for the reports.
You should edit this part to your needs. Check the table below to see a description of each parameter.
Variables
question_code
The question code of your open text
min_date
Optional argument for setting the selectable start date.
Format: yyyy-mm-dd
max_date
Optional argument for setting the selectable end date.
Format: yyyy-mm-dd
To limit the min_date or max_date to the current date you should use:
Examples:
Default calendar, allows all dates
Allow all dates in the past up to this date
Allow all dates as of today
Contrain to custom dates
Conclusion
Once everything is setting up. You should see a datepicker like this. All the validation is handle by the code:

Last updated
Was this helpful?