Actually "onsubmit" is an event of form
element. If you want to catch form submit event (which can be done by clicking button, automatically or by pressing enter, you need to do:
<form ... onsubmit="func();">
otherwise you can catch only submit button click event like:
<input type="submit" ... onclick="func();">