Creating alternative forms for page types
Alternative forms allow you to create additional versions of editing forms for page types, which you can then use in different situations. See Creating alternative forms for more information.
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, the system uses the form automatically for a specific purpose.
Example - Creating a custom Page type insert form
The following example demonstrates how to create an alternative form for the News page type and use it to customize the editing form displayed when creating news articles in the Pages application.
See Extending the page type listing filter for another practical example of using alternative forms with page types.
Adding an alternative form
Create an alternative form for the News page type:
- Open the Page types application.
- Edit () the News page type.
- Switch to the Alternative forms tab.
- Click Create new form.
- Set the names of the form to the following:
- Display name: News creation
- Code name: insert (this is the automatic alternative form code name used for creating new items)
- Click Save.
The system creates a new alternative form.
Configuring the alternative form
After you create an alternative form, you can change its fields using the field editor.
- Switch to the Fields tab.
- Modify the fields as you desire. For example:
- Select the NewsTitle field.
- Type The title of the news article… into the field’s Editing control settings -> Watermark -> Text setting.
- Click Save.
- Select the NewsReleaseDate field.
- Click Edit value () next to the field’s Default value.
- Enter the {% DateTime.Now %} macro into the dialog and click OK.
- Click Save.
- Select the NewsTeaser field.
- Clear the Display field in the editing form check box.
- Click Save.
The alternative form is ready to be used. If you open the Pages application and create a new News page, you can see the modifications made in the alternative form:
- The News title field displays the entered watermark text
- The Release Date field automatically contains the current date and time
- The Teaser field is no longer visible (it is only available when editing existing News pages)
If you edit an existing News page on the Form or Content tab, the original default editing form is used.