In our introduction to using fragments in Visual Builder we showed how to pass in parameters to the fragment, and how the containing page can react to event fired in the fragment. But one scenario we didn't cover was "refreshing" the content of the fragments from an event in the containing page.

Since the way a page communicates to fragments is through passing parameters, this is our  way to cause a fragment to be aware of the need to do something based on an event in the containing page. In the fragment we can create an event that would fire up when an input variable's value changes, and in that event we can use actions that will update the fragment content.

In the sample below we have a fragment that accepts an employee id as a parameter. When the fragment first loads it uses a vbEnter event to fetch the current salary from a REST endpoint and show a calculated salary raise. Initially the fragment is not aware of the fact that the variable that was passed in when the fragment first rendered has changed. We then add an event on that input variable and in it tell the fragment to re-fetch the salary. This ties in the change in the containing page with a change in the embedded fragment.