Fixed JS error preventing submission after validation fail