refactored code to only reset form after successful post

Signed-off-by: Seth Musulin <sethmusulin@gmail.com>