Form verification fixed.
Instead of setting button click listener, used a submit listener for the entire form.
Now it validates like the normal HTML5 method.