I've got an online form that is broken up into several different sections and some of these sections will ask questions where multiple values can be supplied. For instance someone's address or information about their education. Just for simplicity I'll focus on someone's address and I want to collect the following information:
Address Line 1,
Address Line 2,
Address Line 3,
Now while on the same form I would like to make it available so they can supply up to 3 addresses. I don't want to list these questions out three times, just allow them to add another address if they choose to do so.
What I have done so far is create a class called Address and another class to handle the collection of Addresses and then used AJAX to send only that information back to the backend to store this in a session variable until the user submits it with the rest of the application. It doesn't seem the best of practices and wanted to know if anyone has some suggestions for improving it.