Category: How do I do X?
Updated

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.

Date Picker Widget: Unable to set a default value

Issue

I am having difficulty setting a default value for a DatePicker widget using {{date_table.selectedItem.LastContactDate}} as the data source. I am using Google Sheets as the data source and need to use the date from the selected item of a List widget as the default value. I need help troubleshooting and would appreciate any advice or suggestions.

Resolution

Unfortunately, as an AI language model, I cannot provide screenshots or code examples. However, there are a few things that could be tried to solve this issue:



  1. Check that the response of the query that populates the date_table widget has a valid LastContactDate field. If the field is empty or null, it won't be possible to set the default value of the DatePicker widget.



  2. Make sure that the binding between the date_table widget and the DatePicker widget is correctly set up. Specifically, the binding should be set up to use the selected item of the date_table widget, like this: {{date_table.selectedItem.LastContactDate}}.



  3. If the above steps don't work, try setting the default value of the DatePicker widget using JavaScript code. For example, in the onReady event of the page that contains the widgets, you could add the following code:




$w("#datePicker1").value = new Date();

This would set the default value of the DatePicker widget to the current date.

Hopefully, one of these options will help solve the issue and set a default value to the DatePicker widget.