handle submit failure or success