Submits a form and takes action depending on the response.