Question about OnClick Event preventDefault

I want to use OnClick Event when a link or button is clicked on
If status != 1
alert(“You are not allowed to use this link or button”)
RunJS{event.preventDefault(), event.stopPropagation()}
continue or goto the link ref

The question is how do I stop further execution of the link after the alert.

Does it automatically continue to the link or do I need a goto or a command to have it go to the URL the user had clicked on?

If you do not want a button to be functional under certain circumstances, you could hide the button or you could disable it.

Alternatively, have a look at creating a Flow for the on-click event:


My problem is when the user clicks on the link, I want to inform the user that his status is not
allowed to use the link and end. But what is happening is that the user gets the alert teling them the cannot use the link, but then the link is displayed for the user. How can I stopPropagation or preventDefault action in a flow?

The easiest way is to create two links, one that allows the redirect and the other to tell the user that they are not authorised. Something like:

<a href="" class="btn" dmx-show="(var1.value == 1)">Go somewhere</a>
<a href="#" class="btn" dmx-hide="(var1.value == 1)">not allowed</a>

For a more detailed version, have a look at

I want to call a Javascript function I added to the page. My problem is how to pass the event interface object as an argument to RunJS flow action.

My Javascript function is below:
mystopdeaultaction(event) {

You can use the page flows for that.
Instead of an anchor button use a simple html button.
On your page include the browser component - so you can use the goto action.

Create a page flow - add a condition which checks if your variable/value == 1
then > run > gotourl
else > show alert

run this flow on button click.