Hint: Date Picker component and input onChange event.

Hi all,

I found the curiously bug: input vs Date Picker doesn't work as expected.

Short description: I've added to the screen input with local variable and Date Picker pattern from WebUI assigned to this input.

Attempt 1. Simple:

When I choose date, I see that input value is changed. I expect, that input variable will be also changed, but this is not happening, because there is no AJAX request to the server

Well, then attempt 2. A little harder:

I've added onChange event handler action for input. In this action I assing to local variable the new value of input. But again without positive result: local variable doesn't change.

Attempt 3. The right one:

I found that Date Picker pattern have event onSelect. If I assign selected date to local variable in this event handler, all works fine.

Why I wrote this all? This behavior is not what I expect. In 2nd attempt I see, that input value changes in UI, and I expect that onChange event should handle it and send the new data to the server. This event works fine with input without Date Picker pattern, but doesn't work with this pattern.

I hope that my small research will help someone.

BR

Evgeny

Hello Evgeny, 

A question (I can't test this right now). 

When you did your second test, did you actually Used the variable in any place? 

First thing is that variables are updated only when submitting to the server, which happens only if you explicitly have something set to do it, like an OnChange or OnClick or do it through a button/link

Second thing is that every time you submit to a Screen Action (submit or Ajax submit) , the variables bound to inputs are automatically updated if the values are correct (data type and format) and if you are using the variable somewhere in the page, and the platform detects that change the variable value will have impact in the page. 

On any other case, the variable will not be updated. Than my question, as I am expecting your 2° test to also work without the need to assign a value to the variable. 

Cheers. 

Hi, i found also some drawback when using format for the widget, and i turn to other component:

Eduardo Jauch wrote:

Hello Evgeny, 

A question (I can't test this right now). 

When you did your second test, did you actually Used the variable in any place? 

First thing is that variables are updated only when submitting to the server, which happens only if you explicitly have something set to do it, like an OnChange or OnClick or do it through a button/link

Second thing is that every time you submit to a Screen Action (submit or Ajax submit) , the variables bound to inputs are automatically updated if the values are correct (data type and format) and if you are using the variable somewhere in the page, and the platform detects that change the variable value will have impact in the page. 

On any other case, the variable will not be updated. Than my question, as I am expecting your 2° test to also work without the need to assign a value to the variable. 

Cheers. 

Hello Eduardo, 

the sceleton is - input, Date Picker, local variable, expression bound to local variable.

When I'm using onChange input event, the expression on the page doesn't changes. And yes, I do not forgot Ajax Refresh of this expression