Category: How do I do X?

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Return NULL instead of “Invalid date”


I have Datepicker widgets that return "Invalid date" if no date is selected. I want to insert the selected dates into a MySQL DB, but the "Invalid date" value is not accepted. I need an easy way to return null instead of "Invalid date". Fortunately, using {{ DatePicker1.selectedDate || null}} solves the problem.


The task is to allow a null value when no date is selected in a Datepicker widget, instead of returning "Invalid date". The solution is to use the conditional operator and specify that if there is no selected date in the Datepicker widget, it should return null.

For example, if your Datepicker widget is named DatePicker1, you could use this code: {{DatePicker1.selectedDate || null}}. This way, if there is no date selected in the DatePicker, it will insert null. This will allow you to insert into your MySQL database datetime column without getting an "invalid date" error.

Overall, the solution is simple and involves using the conditional operator to specify a null value when no date is selected in the Datepicker widget.