The third feature of our customer registration form application is to capture the customer's residential and postal address. For residential address, we will capture the street address, city, post code, and country. For postal address, we will give users a choice between a PO Box and street address. The choice between a PO Box and street address will be captured using radio buttons, and the appropriate fields will be displayed. For PO Box address, we will capture the PO Box, city, post code, and country.
Let's start by creating the address
attribute in our customer model. The address
attribute will hold attributes for residential and postal addresses. Create the address and residential attributes. In our customer model, the attributes should look similar to this:
address: { residential: { street: ko.observable(), city: ko.observable(), postCode: ko.observable(), country: ko.observable() } }
The next step is to update the view to...