Dan Soares
Dan Soares

Reputation: 380

XPages disable eventHandler

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

Answers (2)

Tommy Valand
Tommy Valand

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

Frantisek Kossuth
Frantisek Kossuth

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

Related Questions