Fix script to check form before submitting it.