O'Reilly logo

KnockoutJS by Example by Adnan Jaswal

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

Capturing personal information

The first feature of our customer registration form application is to capture the title and first, middle, and last name of the customer. We will use a drop-down input component to capture the title. The name fields will be captured using the input text fields. The information will be captured in a model.

Let's start with the names fields as they are simple to implement. Add a model to the RegistrationForm module to capture the customer's first, middle, and last names. The attributes of the model must be Knockout observables for a two-way binding between the model and the view. We will call our model customer and add an attribute to group personal information. The model should look similar to this:

/* the model */ ...

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