Made it so pressing Enter key will submit form.

Pulled out the submission logic into a separate method so that it can
now be called from both the onclick method and the keypress method.