Capturing contact details

The second feature of our customer registration form application is to capture the customers contact details. We will capture the phone number and e-mail address of the customer. We will also ask for the customer's preferred contact. The phone number and the e-mail will be captured using input text fields and the preferred contact will be captured using radio buttons.

Let's start by adding attributes for the phone number and e-mail fields to our customer model. Add an attribute to group the fields; we will call it contactDetails. Now add the attributes for phone number and e-mail under contactDetails. Our model should now look similar to this:

/* the model */ var customer = { personalInfo: { title: ko.observable(), firstName: ...

Get KnockoutJS by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.