Reputation: 380
I have a span tag with an onCLick event handler. I would like to disable the event handler based on the value of a scope variable. The scope variable is being set when I click a checkbox.
How can I do this?
Thanks for your input!
Dan
Upvotes: 0
Views: 74
Reputation: 868
Event handlers have a rendered-attribute that you can calculate. If the span in question is in the area that's being refreshed, you can use this attribute to control if the event handler is active or not.
E.g.
<xp:eventHandler event="onclick" rendered="#{viewScope.someVariable == 'someValue'}" ... />
Upvotes: 0
Reputation: 3524
In client side part of the event use this code.
return !#{sessionScope.disableEvent};
That should render as
return !false; // continues to SSJS
or
return !true; // no SSJS
Upvotes: 1