I have a composite component that is using a PrimeFaces <p:selectOneMenu>
defined like:
<p:selectOneMenu id="inOut" onchange="inOutChanged()">
..
</p:selectOneMenu>
I then have a JavaScript file that is included as part of the component that defines the
inOutChanged()
function like
function inOutChanged() {
var inOut = $({cc.clientId}:inOut);
if(inOut.val() == "INC") {
slider.addClass("includedInRange");
}
}
This composite component works fine when there is only one on the page. The problem is that I need to have 4 of them on the page. So, when I change the select of one composite component it is changing the slider class of the last component. I believe this is because there are in effect 4 inOutChanged()
functions that are all defined within the page.
Is there a way to either scope the function or name it uniquely so that they won't stomp on each other?