Creating alternative editing forms for custom tables
Alternative forms allow you to create additional representations of existing forms, which you can then use in different situations. You can find more information in Creating alternative forms. In Code names of automatically used alternative forms, you can learn about special code names of alternative forms. If you create an alternative form with one of these names, it will be used automatically in the corresponding situation.
The following example demonstrates how to add an alternative form for the sample People custom table (created according to the instructions in Creating custom tables). You can repeat the same process for any other custom table. The example prepares a simplified alternative form that allows users to create records in the People custom table without a date of birth value.
Adding the alternative form
To create a new alternative form for the People custom table:
- Open the Custom tables application.
- Edit () the People custom table.
- Switch to the Alternative forms tab.
- Click Create new form.
- Type a Display name for the form.
- Type insert as the Code name. This special code name ensures that the administration interface automatically uses the simplified form when creating new records in the custom table.
- Click Save.
The system creates a new alternative form for the custom table.
Configuring the alternative form fields
After you create an alternative form, you can change its fields using the field editor.
Switch to the Fields tab.
Select the DateOfBirth field.
Disable the Display field in the editing form option.
Instead of hiding the field, you can experiment with different settings of the field. Try changing the Form control type or the Field caption, or try changing the Editing control settings. This way, you can configure the alternative form as you wish.
Click Save.
You have configured the fields of the alternative form.
Using the modified form
Because you set the alternative form’s code name to insert, it is automatically used in the system’s administration interface when creating new records for the People custom table.
- Open the Custom table data application and edit the People table.
- You can also select the Data tab when editing the People table in the Custom tables application.
- Click New item.
You can see your modified alternative form when submitting a new record into the custom table (without the DateOfBirth field). If you edit an existing record, the original form with all fields is displayed (this editing form could be replaced by an alternative form with the update code name).
Displaying the alternative form on the live site (Portal Engine)
On Portal Engine websites, you can quickly add the custom table’s editing form onto pages using the Custom table form web part.
- Open the Pages application.
- Switch to the Design tab.
- Place the Custom table form web part on a page.
- Configure the web part.
- Select People (customtable.people) in the Custom table property.
- Click Select next to the Alternative form name property.
- The alternative form takes precedence over the selected custom table’s default form.
- Choose the class (custom table) and alternative form in the displayed dialog and click Select.
- Click Save & Close.
The alternative form appears on the page (without the DateOfBirth field). Users can submit the form to add new records to the custom table.