I had to create an empty template component and use it to lauch the dialog:
<br /> $('#[IdOfTheTemplate]').text("The following fields are empty: " + emptyFields.join(", ") + ". Are you sure you want to continue?").dialog({ ...