Move the submit logic to the animation handler.