Value Changed vs Value Updated behavior

Hey,

I am seeing inconsistent behavior on a select field when applying a value updated/value changed event.

In this example on a bare test page I have the following logic on the select field:

As expected, when changing value to Option 1, I get True, when the value is not Option 1 I get false!

When applying this exact same logic on a non-test page things turn out differently:. Here is the logic:

When I select option 1 (value = 1) in the select menu, notifications do not fire. No matter what the selection is, nothing happens.

When the Dynamic Event is changed from Value Changed to Value Updated notifications trigger as expected.

Since this is a dynamic field that gets populated, I need to use Value Changed since Value Updated triggers other events when the value is updated dynamically.

Does anyone know why the behavior is different between the pages or more importantly, how to get the Value Changed to fire as expected?

Please check

Thanks I checked that before posting. This was working before and now it seems it’s as Patrick describes in his post “with the change event it is possible that the value still contains the old value”.

I have a select menu that’s dynamically populated. The user can then change this select menu. When the user changes it triggers a record update.

The problem I’m running into when using “Value Updated” is that on page load, the select menu is updated (from null to dynamic value) and it therefore triggers an update event.

Any recommendations so that the record update is only triggered when changed by the user?

Maybe @patrick can suggest some solution here.

I sometimes use an inline flow with condition to choose whether to initiate a SC call/other action.

e.g.

<dmx-value id="var_name" value="0" dmx-on:updated="run({condition:{if:`value > 0`,then:{steps:{run:{action:`someseverconnect.load({parameter:`select1.value`},true)`}}}}})"></dmx-value>
<select id="select1" name="somename" dmx-on:changed="var_name.setValue(1)">
...

The sever connect is only fired if the value is above 1 (i.e. the user has changed it)

In your case, set a variable to 0 on success of the server connect and use an on-updated (with a condition) on the variable to trigger the SC which looks at the select value. The select on-change event would then change the variable to 1 which triggers the whole process.

From what I understand you are telling that the changed event doesn’t work correctly on a specific page while it was working on a test page. Of course the changed event should work on each page the same, so something must go wrong.

Does the last code you posted work, the one where you set the value on the changed event?

Alternative you could try the change event. You are using a flow, there you can add a small wait action as first step, 1ms should be enough for app connect to have the updated value.

It works on the test page but does not work on my actual page.

On my test page, I have a select input that’s dynamically populated. On Value Changed it triggers notifications successfully.

On the actual page, I have a select input that’s dynamically populated.

I set a wait period of 1 then 500 and no luck in either cases.

I copied the first select and set its logic to when Value Changed:

It does not fire. When I change it to Value Updated it fires.

I further simplified it by having a select field that when Value Changed fires a notification:

No luck.

The strange thing is, when I run this test with an Text Input, On Value Changed, notifications fire.

I don’t see console errors or code errors in Wappler.

Let me know if there’s any other information I can provide to help.