FoxInCloud
Date(time) picker
Gravatar is a globally recognized avatar based on your email address. Date(time) picker
  Vincent H.
  All
  Feb 2, 2024 @ 03:44am

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()

Gravatar is a globally recognized avatar based on your email address. re: Date(time) picker
  FoxInCloud Support - Thierry N.
  Vincent H.
  Feb 2, 2024 @ 06:54am

Vincent,

Not sure what you want to do.

Can you share a code sample and/or screenshot with expected and undesired behavior?

Gravatar is a globally recognized avatar based on your email address. re: Date(time) picker
  Vincent H.
  FoxInCloud Support - Thierry N.
  Feb 2, 2024 @ 08:59am

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()

Gravatar is a globally recognized avatar based on your email address. re: Date(time) picker
  FoxInCloud Support - Thierry N.
  Vincent H.
  Feb 3, 2024 @ 08:03am

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!

Gravatar is a globally recognized avatar based on your email address. re: Date(time) picker
  Vincent H.
  FoxInCloud Support - Thierry N.
  Feb 3, 2024 @ 08:27am

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

Gravatar is a globally recognized avatar based on your email address. re: Date(time) picker
  FoxInCloud Support - Thierry N.
  Vincent H.
  Feb 4, 2024 @ 02:40am

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…

Gravatar is a globally recognized avatar based on your email address. re: Date(time) picker
  Vincent H.
  FoxInCloud Support - Thierry N.
  Feb 4, 2024 @ 03:28am
...
WITH THISFORM
   Mdatej = EVL (.wDateJour, DATE())
   .Saisiedate.Value = m.Mdatej
...

Thanks

Gravatar is a globally recognized avatar based on your email address. re: Date(time) picker
  FoxInCloud Support - Thierry N.
  Vincent H.
  Feb 5, 2024 @ 05:30am

Well, here is what I understand :

                 .init()   .refresh()
.wlDatePicker      .T.         .T.
.controlSource     ""          ?
.value             .F.       m.Mdatej (type D)

Is this connect?

Gravatar is a globally recognized avatar based on your email address. re: Date(time) picker
  Vincent H.
  FoxInCloud Support - Thierry N.
  Feb 5, 2024 @ 06:29am

yes, excellent summary !

Gravatar is a globally recognized avatar based on your email address. re: Date(time) picker
  FoxInCloud Support - Thierry N.
  Vincent H.
  Feb 5, 2024 @ 11:38pm

Did you try to set .value=<some date> at design time or in .init()?

Gravatar is a globally recognized avatar based on your email address. re: Date(time) picker
  Vincent H.
  FoxInCloud Support - Thierry N.
  Feb 6, 2024 @ 02:19am

In form.Refresh()

Gravatar is a globally recognized avatar based on your email address. re: Date(time) picker
  FoxInCloud Support - Thierry N.
  Vincent H.
  Feb 6, 2024 @ 07:32am

In order to get a date(time) picker, you need both these conditions at design time or .init():

  • .wlDatePicker = .T.
  • vartype(.value) $ 'DT' and/or 'D' $ .Format for a datepicker
© 1996-2024