Hi Thierry,
Selecting a date does not always follow the same rules.
wlDatePicker is useful when the date to be entered is close to today's, but not practical for a date of birth for example.
So I sometimes initialize it to .F.
But in this case, the date (or date and time) is displayed correctly when the controlSource of the field is entered in the form, but not when it is entered at screen initialization or in a Refresh()
Vincent,
Not sure what you want to do.
Can you share a code sample and/or screenshot with expected and undesired behavior?
This first screenshot is with wlDatePicker = .T.
The date is clearly displayed
Same thing, but with wlDatePicker = .F.
The value of the control (of the date) is entered during Refresh()
Hi Vincent,
Description of property awTxt.wlDatePicker
says
Set at design time! {en} add a jQueryUI/BootStrap HTML date picker if .Value and/or .Format is a date
FoxInCloud does not support setting xxxTxt.wlDatePicker
at run time.
If you want to do so, you need to add the JavaScript yourself :
procedure refresh
…
local cJS
text to cJS textmerge noshow
jQuery('#<<this.wcID>>')
.val('<<alltrim(.text)>>')
.addClass("datepicker datetimepicker-input")
.datetimepicker({locale: navigator.language.substr(0,2)||'en'||'', format: 'MM/DD/YYYY HH:mm:ss', sideBySide:true});
jQuery('#event_scx-pgf-pag1-txtdate').on('change.datetimepicker', function(e){return !e.oldDate === null && FoxInCloud.EventRequest('DOMEvent','blur', this, e.date.toDate());});
endtext
thisForm.wcScriptJSadd(m.cJS) &&
Be aware that this JavaScript is quite tricky!
Thank you Thierry,
Nice code!
But I don't set the property at runtime, I only fill its controlSource at Refresh()
Otherwise it works great
But I don't set the property at runtime, I only fill its controlSource at Refresh()
Maybe the easiest way to understand is to share your design-time setup and .refresh()
code…
...
WITH THISFORM
Mdatej = EVL (.wDateJour, DATE())
.Saisiedate.Value = m.Mdatej
...
Thanks
Well, here is what I understand :
.init() .refresh()
.wlDatePicker .T. .T.
.controlSource "" ?
.value .F. m.Mdatej (type D)
Is this connect?
yes, excellent summary !
Did you try to set .value=<some date>
at design time or in .init()
?
In form.Refresh()