One technique woudl be to create a new button that the user would interpret as the submit button (I will call this a pseudo submit button). You would make the real submit button invisible (so the user cannot see it or click on it, but it can still be used programmatically). Now on the pseudo submit button put your code to validate your information. If this validation passes then click the real submit button. To do this run this code:
submitbuttonname.execEvent("click");
If the validation fails then put a message up. In this technique the real submit cannot be pushed until the validate succeeds.
Hope this helps.