Check that form validates before submitting