I had to move this down below the function definition to get things to work. The onload event isn't firing and the view isn't created so the form event (that submits and reloads the page) isn't cancelled.