O'Reilly logo

HTML5 iPhone Web Application Development by Alvin Crespo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Form validation

In this section, we review the JavaScript written for this page. There's nothing that's really new or that pushes the boundary; it is explicitly meant to demonstrate how to use the framework we've developed in this book to create self-contained code that validates multiple forms and makes it easier for you to extend. So let's get started by reviewing the basic template.

The basic template

The following is the basic template we've been using. A standard namespacing technique that extends the App namespace with a Form class will contain all of our functionality.

var App = window.App || {}; App.Form = (function(window, document, $){ 'use strict'; var _defaults = { 'element': 'form', 'name': 'Form' }; function Form(options) { // Customizes ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required