I often need to alert the user that nothing was run because of incorrect input. Instead of trying to show an error message inside a data.frame using renderDataTable(), for example, or keeping a separate output object for that, I came up with a way to show a javascript alert from server.R. Here is an example for those unfamiliar with addCustomMessageHandler(), who need similar functionality.
Add the following to ui.R:
tags$script(type="text/javascript", "
$(document).ready(function() {
Shiny.addCustomMessageHandler('showalert', function(message) {
alert(message);
});
});
"),
Use inside server.R:
session$sendCustomMessage(type = "showalert", "error message here")