Adding event listener using dojo on custom attribute in ccm
Hello,
I am trying to add an event listener on a custom attribute in ccm using dojo. I came to know that we have WorkItemAttributes, but that restricts the user to only fetch internal/system attributes. Could you please help me on how can I attach an on change event handler to a radio button (enumeration) in CCM using dojo?
Regards,
Rohit Goyal
One answer
Hi Rohit,
Try this.. on function to attach the event listener to the radio button element.
require(["dojo/query", "dojo/on", "dojo/domReady!"], function(query, on) {
// Replace "radioButtonID" with the unique ID or class of your radio button element
var radioButton = query("#radioButtonID")[0];
// Attach the event listener to the radio button
on(radioButton, "change", function() {
// Access the selected value of the radio button
var selectedValue = radioButton.value;
// Perform your desired actions based on the selected value
// For example, you can log the selected value to the console
console.log("Selected value: " + selectedValue);
});
});
I hope it help you.
// Replace "radioButtonID" with the unique ID or class of your radio button element
var radioButton = query("#radioButtonID")[0];
// Attach the event listener to the radio button
on(radioButton, "change", function() {
// Access the selected value of the radio button
var selectedValue = radioButton.value;
// Perform your desired actions based on the selected value
// For example, you can log the selected value to the console
console.log("Selected value: " + selectedValue);
});
});
I hope it help you.