Typically in an HTML5 application, you can let the built-in HTML5 form do the work for you.

Also, replace all instances of 'app' with 'application'.