Factored out submit button code.