In this last section you will create the page containing the form that allows adding new entries in the detail table, automatically adding the value for the foreign key field that stores the association to the master table.
To create this page, follow the next steps:
Open the detail_form page in Dreamweaver.
Apply the NeXtensio Form Wizard, as for the Master Form. Remember to change the table to use to contacts_con, and the UI persistence will do the rest.
The only thing to consider is to remove the idcom_con field from the list presented at step two of the wizard.
After you've finished the wizard configuration, click the Finish button to close it and add all elements into the page.
When updating an existing contact for the currently selected master company, the idcom_con field is not required. When adding a new contact however, you have to add a value for the idcom_con field, to associate the contact with a company. And since the form is a detail for a specific company, using a drop-down menu is not right. Since the company ID is already known (being passed through the id_com URL parameter added to the Add new link), you can add directly its value to the transaction.
To add new fields to existing transactions, you will use the Add Transaction Fields server behavior. Access it from the Server Behaviors tab > + > MX Kollection > Forms > Advanced.
In the dialog box that opens, click the Plus (+) button to add a new field. From the list that is displayed, select the idcom_con field.
For its value, which you can set through the text
field at the bottom of the page, enter the following InterAKT
mark-up: {GET.id_com}

At this point, the idcom_con column is added to both transactions that exist on page: the insert and update. As mentioned at step 5, the update transaction does not require the presence of this field.
To make the field available only to the insert transaction follow the next steps:
Switch to the Advanced tab of the dialog box.
Select the update transaction in the grid (its name starts with update, so it is easy to spot) and click the minus (-) button on top of grid.
Only the insert transaction, must remain in
the list, as you can see in the image below.

Now save the page and upload it to the server.
You can test out the pages you've created, starting with the master list, and through the created links, navigate the details. If you add a new detail record, it will belong to the master company selected in the first page.
Good candidates for the master-detail situation are also tables that use self foreign keys. To learn more about tables and self foreign keys, read this article. One such table would contain a column storing the parent's ID. As an example, consider a table that stores categories for products. If you want to use sub categories (e.g. under electronics, you want to have microwave ovens, refrigerators and more) you can do it without using yet another table (that would be unpractical). Simply use a column that stores for the parent of the current category, and for the top-level categories use NULL.
The structure of a table using self foreign-keys is as follows:

To create the NeXTensio master and detail lists and forms, the steps are similar with the ones taken for the two table case, with the following differences:
The master list must display only records that are top-level. To do so, you must manually alter the recordset and add the condition (e.g. idctg_ctg IS NULL)
The detail link in the master list page will have to pass the category ID as URL parameter.
In the detail list page, the recordset must retrieve only records that have the self foreign key equal to the URL parameter passed from the master list (e.g. the main category's ID).
The add new link in the detail page will have to pass the main category ID as URL parameter to the form. This value is in fact the value of the self foreign key for the current set of records (e.g. the idctg_ctg column value).