XForms/Insert

This lab allows you to insert a new row into a tabular structure. We don't use a HTML table here, just a form that updates two items in the model.

Here is the input before you add any new data:



Discussion
This program has a model of the existing phone list and one additional NewPerson data element at the end of the list. The new person data is linked to the two field form at the end of the table. When you hit the insert button (the trigger) it will copy the data elements from the mini-form and copy them into a new location inside the existing model. The entire list will then be updated. The exact location of where the insert occurs is determined by the index function. The index is the number of the row you last selected.

There are two items to note. First of all, you can select any row just before you do an insert. The new item will be inserted just after this row.

The second thing to note is that you will still need to be able to delete a record. That is the next lab.