Trigger Function in sibling webBlock

I have a web screen set up in a similar fashion to below, 

'Trigger webblock' contains an event 'Trigger()'.  Within TriggerWebBlock a button is pressed, then on the OnClick event, the trigger is fired. This makes a call to a function within the parent - ParentHandler().  Now what I need is when ParentHandler() is called I need to access and call a function held inside the 'EventWebBlock' -'EventBlockHandler()'

This function assigned a value to a local variable and the block is refreshed via ajax with the new variable value displayed in the expression.

I have all the functions built but I cannot see to execute 'EventBlockHandler() from outside the webblock.

Any and all help is appreciated


Hi Jim,

Thank you for a great description and diagram, that really helps.

This is one of the issues with webblocks as they stand.  There is no direct way to call an action inside a webblock from its parent.

However, there are a number of options.  Which option you choose depends on your situation.  Without any context though, I am listing them in my own order of preference:

* Modify the data to be changed in EventWebBlock to be an input parameter(s).  Modify the parameter in Parent-MainContent in the ParentHandler() then ajax refresh the EventWebBlock. Create a server action to perform whatever processing is required to calculate the parameters then pass them into EventWebBlock. The functionality of EventWebBlock is then no longer encapsulated, as there is an action that must be used in conjunction with the webblock.  And the EventWebBlock must be able to handle an initial state as well as an intermediate state in its Preparation.

* Merge the content of the EventWebBlock into the Parent-MainContent component.  The event can then trigger the required functionality. However, this can result in duplicated code if EventWebBlock is required elsewhere.  Using server actions can reduce this duplication but not eliminate it.

* Trigger events on the client side. Use jQuery custom events (our your own javascript) to trigger a message from Trigger WebBlock. Listen for the event in EventWebBlock.  If server processing is required, use a hidden button in EventWebBlock and trigger a click() event on it to call EventBlockHandler() action in the EventWebBlock.

There is also the event plugin, which is commonly suggested in this scenario. However, I haven't found it fits my needs as yet so cannot comment on how best to use it.  I believe it can result in multiple HTTP requests, but again I'm not an expert on it.  It is worth a look.

One of the issues I always consider in these scenarios is to ensure there is a single HTTP request, rather than multiple.  The main design decision in my view is to determine when the processing should jump from client to server side.

I guess this is not likely as straightforward as you had hoped.  But I hope it helps nonetheless.

Kind regards,



Stuart Harris wrote:

Hi Jim,

Thank you for a great description...


...I guess this is not likely as straightforward as you had hoped.  But I hope it helps nonetheless.

Kind regards,


No, Stuart, you have described almost to the word the solution we were looking into.

The problem can be defined as this.

There is a page with 4 tabs, one tab contains user details a second tab contains registered cards, under the list is the current address of the user taken from the DB.

The user can edit their contact details on the first tab, this tab is a web block and is repurposed/shared across several screens.

In the second tab the second web block contains the card detail information, this is also a block because it too is used in other screens.

When the user updates their contact detail the save is done via ajax and the container refreshed to show the new address details.

And this is where the problem comes in if the user switches to tab 2 before refreshing the page, the old address appears inside the web block, refresh the page it is updated naturally.

We discussed your first option and would have gone down that route. but at the end of the day the amount of dev time used to implement a refresh on a tab that is unlikely to be switched to unless, in some specific circumstances, I might as well do a full page refresh rather than Ajax each and every block every time an event happens.

Stuart, Thank you for the advice I would have followed it but sometimes you have to think, is the smart and clever way the best way?

Occams Rasor comes to mind, my friend :)