If you want to set NULL (or better Nil) date into a WebDatePicker on Web 2.0 (Xojo 2020 r2.1) is actually not possible because the date field remains with the old value.
If you want to delete the old input just type:
WebDatePicker1.ExecuteJavaScript("document.getElementById('" + WebDatePicker1.ControlID + "_input').value = '';") WebDatePicker1.SelectedDate = Nil
2 Likes
Bug 63842. Unless I create a sample project for Xojo, it looks like it’s just going to be closed. Do you have a sample project lying around to save us all a lot of time?
Based on your code I wrote an Extends as follows:
Public Sub clearDate(extends DP as webdatepicker)
DP.ExecuteJavaScript( "document.getElementById('" + _
DP.ControlID + "_input').value = '' ; " )
DP.SelectedDate = Nil
End Sub
Thanks for your post!
3 Likes