Multiple entries into a database

I have a form, that is being entered into a database, i have posted a screenshot, i would like it so that when you press the plus symbol next to the phone number , it would open another text field for another phone number entry. This also means that on the database, under one entry in the database, there would be multiple phone numbers attached to this one entry. How would i be able to do this?    
1 answers

Hi Jordan,

Should the user be able to enter just the second phone number, or do you want him to be able to keep adding phone numbers by clicking the 'plus' button?


In the first scenario I would just add an attribute to your entity featured in the form like 'SecondaryPhoneNumber' and show it on the page. If it really needs to be hidden at the start, you could work with conditional visibility and a boolean attribute to show/hide the field.


In the second option you can add an entity 'PhoneNumber' (or 'ContactDetails' with an enum Type 'Phone' so you could easily expand this with 'email' etc) and connect that entity to the one featured in the form. At creation of the form object always also create a PhoneNumber entity and show it in an editable listview on the page. The pklus sign can then add a new entity to the list view.