Question

1
Replies
638
Views
SSrinivas Member since 2015 52 posts
Virtusa
Posted: 2 years ago
Last activity: 2 years 5 months ago
Closed

unable to trigger on change event from javascript

Hi Everyone,

using javascript I'm trying to set the value and trigger the onchange event configured on Dropdown. Below is the markup of select.

<select name="$PColorsPage$pColors" id="Colors" style="width: auto;" data-ctl='["Dropdown"]'  data-change='[["refresh", ["thisSection","", "", "&amp;=", "", ",",":event","","ColorsPage"]]]'><option title="Select..." value="">Select...</option><option title="Red" value="2">Red</option><option title="Yellow" value="3">Yellow</option></select>

Below is js code I have tried in console. But its not triggering the fireEvent method.

var element = document.getElementById('Colors');
element.selectedIndex=2;
pega.util.Event.fireEvent(element,'change');

The reason I'm trying to explicitly trigger the event because of Automation unable to identify the onchange event, as pega is adding the event to data-change attribute.

Thanks
Srinivas

***Edited by Moderator Marissa to update categories***

Low-Code App Development Data Integration Java and Activities User Interface
Moderation Team has archived post
Share this page LinkedIn