onclick event

  
Hi.

I have buttons or links that I just want to run an onclick event, but they always require a destination.

What I do is set the method to Ajax, assign the destination to a "dummy" action (an empty action) and them set the onclick event in the extended properties.

Is there a better way to do this?

Some people use the Navigation method and then set the URL to "#"..


Carlos Henriques wrote:
Hi.

I have buttons or links that I just want to run an onclick event, but they always require a destination.

What I do is set the method to Ajax, assign the destination to a "dummy" action (an empty action) and them set the onclick event in the extended properties.

Is there a better way to do this?

Some people use the Navigation method and then set the URL to "#"..

 
 
 Hi Carlos,

Using a button linked to a dummy action is probably the most straightforward way of doing it (although I understand it might feel as a workaround...). But it's fast to build, and it's a recognized pattern by the developers - in the end, that's good.

The navigation method is fine, as you don't have to add a dummy screen action.

If you really want to investigate alternatives, you can add a web block on which you build the button using html (via an unescaped expression). The web block would receive the label and the onclick code via input parameters. Note that you might risk having different implementations for the same problem, if the developers are not fully aware of the new pattern.
That's a good alternative. Thanks :)