:onclick function executing on page load

Erm, yeah, that's messed up.

Event.create is Ruby code (I'm assuming Event is a model in your application), and it's being executed as the template is being rendered. The return from save! (which is redundant, because create saves the row) is passed as the content for the onclick attribute of the generated submit button.

Rather than trying to "fix" this, I think you need to back up and walk through a Rails tutorial so you can get the basic pattern down. For instance, you will rarely (if ever) use an onclick event on a submit button.