Why my form hangs when submitting?