The easy option is to add Validation to the fields. I'm assuming that you cannot do that for whatever reason - perhaps you don't want to display any warnings to the user until the person clicks.
Here's a form with an example of how to show a dialog conditioned on the sum. Hope it helps.