Using JavaScript with "among this region's items" buttons
As we saw, the among this region's items type of button doesn't support redirection, hence doesn't include a URL field. As a result, it makes it harder for us to attach JavaScript code to the button.
We can resolve this limitation in several ways, but here we'll review two of them.
Using this type of button, we usually want to render a button adjacent to an existing page item. Instead of using a dedicated APEX Button, we can use the Post Element Text field of the item to define an HTML Button. We can use an onclick
event to attach any JavaScript code that we need to the button. In the "The Pre/Post Element Text fields" section of Chapter 5, we can see an example of using an APEX shortcut to do just that.
If we are using template driven buttons in our application and we want to maintain uniform looks among all our buttons, then we can harness the button Attributes field to help. Originally, this field was designed to hold the button...