Guys, I need to reset (clear) the Data Picker field back to its default value shown when the page/form is loaded for the first time, showing only the “Placeholder Text”, no date value.
Something like this:
$w(“#MyDatePicker”).value = “” ;
This obviously doesn’t work because the the object is expecting a valid date format, but there has to be a ways to reset the Input Field back to its original state.
Thank you for your reply Tal, much appreciated. But what I’m looking for is to reset it in BLANK, no value whatsoever, No date, just a blank field showing only the “Placeholder Text” .
Setting to Null does clear the date picker. However if the associated datafield had a value and then was cleared with this code by setting the date picker to null, then the record is submitted, the datafield value will retain the previous value.
Thus reloading the record will show the date previously entered.
I have not found a way to clear a date from a date picker field.
If a date picker is connected to a dataset, setting its value in code will not submit that value to the data collection. Setting the value in code only changes its value in the GUI; to change it in the dataset, you also have to add this line of code:
I’m having the opposite problem, My Date Picker inside a repeater is connected to a data collection, but it is not showing the associated date value, it is only showing the Placeholder text. I need it to show the value from the database. How do I set the date picker value to the value from the data collection.
Would it work like this?
$w.onReady( function () {
$w(“#datePicker1”).value = $w(‘#itemsDataset’).getCurrentItem().startDate
});
Drew, what mode is your dataset set tot? It should be mode “Read-Write” for it to both read the current value from the data collection and write to it if it’s changed. Hope this helps.