js form errors, end brace in wrong place