Refactor handling invalid task form.