allow to pass an on success handler to the submit function