My dropdown onchange action triggers automatically sometimes when im navigating to my screen.
This only happens on my dropdown and not in any other input type.
How can I prevent this
I use an aggregates list as its source list
Hello,
I've faced this annoying behavior before. The way I found to work around it was to use javascript in the "OnChange" event. In the True branch of the IF, you do whatever you need to do when the dropdown is changed by the user:
The javascript code:
if (event && event.target.nodeName && event.target.nodeName.toLowerCase() === 'select') { $parameters.IsDropdown = true;}else { $parameters.IsDropdown = false;}
There is no need for an "if" there, this code can be simplified to: $parameters.IsDropdown = event && event.target.nodeName && event.target.nodeName.toLowerCase() === 'select';
Actually, there is. I put the "if" there for a reason. Without it, you'll get this error:
Fair enough, have you tried to convert the possible undefined values to boolean, something like:
$parameters.IsDropdown = !!event && !!event.target.nodeName && event.target.nodeName.toLowerCase() === 'select';
Hi @Kadir Aksu ,
Do you mean that when you navigate to the screen where the dropdown is present, the action assigned to the 'On Change' event is automatically performed? That is strange, as that action should only be triggered when you change something in the dropdown. Could you be triggering some additional logic in the screen event where the dropdown was created? By that, I mean some event in the screen life cycle that you could be unaware of, triggering unexpected behavior.
Best,
JoĂ£o
Sometimes this actions triggers when the dropdown is load with info from example a DataAction, maybe you can validate in the OnChange if for example the Id is <> than Null, if is different from null maybe set the selected value otherwise do nothing.
Greetings
Hello @Kadir Aksu , - Please check your empty text property , something written or not check it, some time this field empty that time automatically select first value from the dropdown. - "Select Dropdown value" - written this text in Empty Text , Show in image :-
Are you by any chance using the variable assigned to the dropdown to set a default value in the OnReady event?
I checked that by using an data action it seems to trigger the OnChange event of the dropdown but it seems that it is not your case since if i am not wrong you are using a aggregate.