It looks like you are reading the dimensions when you submit the form, so when you "return false" if the dimensions are wrong it's the "onload" event you are cancelling, not the form submit.
If you look at this way of doing it;
javascript - Is it possible to check dimensions of image before uploading? - Stack Overflow[
^]
the submit event is cancelled, and the onload event then does the form submission once the dimensions have been checked.
Google for "html5 check image dimensions before upload" and you'll find other examples too.