add event listeners to handle form submission