I am unable to come up with the right code that will allow me to blank a WebDatePicker control when scrolling through records where some records have a date and other records do not have a date for that field. Any thoughts?
I was able to come up with a work around by putting the WebDatePicker control into a container, make it look like a button and add a WebTextField. I added code that would “hide” the selected date in the WebDatePicker control, place the selected date into the text field, use the date in the text field when saving the data to the database, and populate the text field when updating date controls from the database.
Perhaps I don’t understand what you mean by “blank” but for deleting the date I do
datepicker.value = nil
In instance of 2020r2 the WebDatePicker control does not have the Value property and the SelectedDate property will not except nil as it requires a valid date.
What I mean by “blanking” is to remove or clear the existing value like TextField1.Text = “”.
I have the same problem, i can’t (delete, clear, Blanking) WebdatePicker,
datepicker.value = nil, the sintaxis is good (compiled) but do not work
datepicker.selectedDate = Nil , do not work, either
Hey Hernan and a Happy New Year to you. I was beginning to think I was the only one experiencing this issue.
According to the WebDatePicker - Xojo Documentation, WebDatePicker.SelectedDate requires a valid DateTime value and, as you say, assigning it a Nil value does clear the existing value from the control. WebDatePicker.Value isn’t even listed as a property so I’m not sure why that works for Hector. I am happy with my work around as it behaves the way I expected the WebDatePicker control to behave – when updating controls with a new record from an SQLite database, the date field is populated or cleared based on the data. It is not a perfect solution, but it works for me. Maybe this will get resolved in the future or maybe someone with more knowledge than myself will offer the correct way to clear a WebDatePicker control. Unfortunately my original question hasn’t recieved much attention.
@Thomas_Frazier I haven’t found a way either and I do like your workaround. The question if it is really a bug, or if it is a bug that we don’t need to specify a date when starting the app. Other language have this feature as well, that you have to select one date.
Invalidation is then done via putting an unlikely value into the field. For instance 1.1.1901 or 1.1.1970 …
Though I do agree, that it should be possible. If not done yet, it would be good to create a Feeback Case for it, to bring it to the attention of the engineers. One would think that it should be a simple fix, but you never know.
Thank you for responding. I have read many posts from you and respect your knowledge and willingness to share that knowledge with others. If you haven’t found a way either, I feel confident there is not a way. I appreciate hearing you like my workaround. That was my first attempt at something like that and was surprised I was able to make it work across multiple webpages. It was a good learning exercise.
As suggested, I will create a feedback case when that site is back up.
The .value property was listed in the autocomplete list in Xojo 2020R1 it still works for setting the date but unfortunatelly not for clearing the webdatepicker control’s diplay . It probably has been deprecated as it no longer appears in the autocomplete.
I have entered the following Feedback case 63204 - WebDatePicker control needs a way to remove the displayed date programmatically. I classified it as a bug since controls that display a value should have a way to clear the value from that control programmatically (IMHO) and the WebDatePicker control does not appear to provide that ability.
Defenitely a bug, there has to be a way to “clear” a control’s display. I’m hoping it will get fixed soon.
Thank you very much, i hope the bug to be fixed asap
Best regards for all, and we keep in contact
Update on Feed Back case 63204 - WebDatePicker control needs a way to remove the displayed date programmatically
Greg O’Lone January 4, 2021 - 3:56pm UTC
This feature has been implemented. Our testing staff will confirm the feature satisfies the details of the case.
I honestly did not expect this to be addressed so quickly - thank you Xojo. Maybe it will part of the next release.
Now we just need to wait for the next release
My experience: if it is an easy change Xojo is very fast in getting it implemented (not necessary rolled-out, as this depends on many QA factors), as long if the Feedback Cases are reproducible and well explained.