If I am interpreting what you want to do properly, this is a JavaScript question, not a Perl question.
Stopping the browser from submitting has to be done from the JS.
You would need to write an onSubmit handler that checks all your fields for values and returns false if they are all empty.