133
Views
8
Comments
Solved
[OutSystems UI] Datepicker does not output event when typing in and clicking somewhere else
outsystems-ui
Reactive icon
Forge asset by OutSystems
Application Type
Reactive

Hi, 

It's me again :-)

When using the new datepicker  in combination with the editable client action, we have noticed that if you type in the date, and click somewhere else on the page to close the datepicker, the datepicker component does not output the OnSelected Event. 

Which results in a red border on a required datefield in our form when validating it, but the user thinks he has already entered the date.

Is there a way to solve this on our end or is this a bug?


Kind regards,

Bas

2022-11-12 11-28-30
Gonçalo Martins
Staff
Solution

Hi @Bas de Jong
Can you please check my sample?
Hope it helps.

Cheers,
GM

DatePickerSample1.oml
2023-04-19 18-38-51
Bas de Jong

Hey,

Thanks for the sample. That actually works, but my usecase is a little bit different . Instead of the alert in your sample i actually want to grab the date that was entered in the input field and let the DatePicker select action run. 

I have attached the OML 


according to the flatpickr documentation i have made 3 input parameters of type object in my client action:

https://flatpickr.js.org/events/#hooks

Thanks for your help so far!

DatepickerIssue.oml
2023-04-19 18-38-51
Bas de Jong
Solution

Thanks!!! the key was that the platform automatically added/autocompleted the brackets:

i initially had this:

$parameters.OnClose = $actions.HandleDatePickerClosed();  

instead of:

$parameters.OnClose = $actions.HandleDatePickerClosed;  



2022-11-12 11-28-30
Gonçalo Martins
Staff

Hi @Bas de Jong 

That is the default behaviour from the flatpickr library, not a bug (actually it changes when using Enter on the input).
However, you can add an on close event using the extensibility actions (SetFlatpickrEvent/UnsetFlatpickrEvent) in this case to achieve that use case.

You can get some documentation (also available on the Documentation tab of the component) here:

Hope it helps!

Cheers,
GM

2023-04-19 18-38-51
Bas de Jong

Thanks for your answer. I tried registering the onClose event, but i run into some errors:

My flow:


it looks like this callback is only triggered once, when initializing the component. Any further callbacks result in the uncaught type error.

2022-04-08 16-49-21
José Rio

Hi @Bas de Jong,

Is it possible to share the oml with that implementation?

Tks in advance,

JR

2022-11-12 11-28-30
Gonçalo Martins
Staff
Solution

Hi @Bas de Jong
Can you please check my sample?
Hope it helps.

Cheers,
GM

DatePickerSample1.oml
2023-04-19 18-38-51
Bas de Jong

Hey,

Thanks for the sample. That actually works, but my usecase is a little bit different . Instead of the alert in your sample i actually want to grab the date that was entered in the input field and let the DatePicker select action run. 

I have attached the OML 


according to the flatpickr documentation i have made 3 input parameters of type object in my client action:

https://flatpickr.js.org/events/#hooks

Thanks for your help so far!

DatepickerIssue.oml
2022-11-12 11-28-30
Gonçalo Martins
Staff

Hi @Bas de Jong 

In the assignment, you're calling the action instead of a simple assignment :) 


2023-04-19 18-38-51
Bas de Jong
Solution

Thanks!!! the key was that the platform automatically added/autocompleted the brackets:

i initially had this:

$parameters.OnClose = $actions.HandleDatePickerClosed();  

instead of:

$parameters.OnClose = $actions.HandleDatePickerClosed;  



2022-11-12 11-28-30
Gonçalo Martins
Staff

Correct! Is a common mistake don't worry.
Glad to know it could help. I really advise taking a look at these new features since in an iterative way we're providing more and more extensibility power to the developers on these components using providers on a more low code way :)

Cheers,
GM 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.