your code is checking acc_tot_3 and then acc_tot_2, which is not the order that you describe in your scenario. Is that part of your problem?
Also, you're not exiting your for() statement, so as soon as you hit a non-blank acc_tot_X you're going to submit, and your user will never have had a chance to correct the blank one(s).
You need to loop through all your fields and set a flag if one or more is blank, then submit or not based on the value of the flag, rather than including your submit inside the loop in the else clause.
|