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.

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:

  1. Open the Page types application.
  2. Edit () the News page type.
  3. Switch to the Alternative forms tab.
  4. Click Create new form.
  5. Set the names of the form to the following:
  6. 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.

  1. Switch to the Fields tab.
  2. Modify the fields as you desire. For example:
    1. Select the NewsTitle field.
    2. Type The title of the news article... into the field's Editing control settings -> Watermark -> Text setting.
    3. Click Save.
    4. Select the NewsReleaseDate field.
    5. Click Edit value () next to the field's Default value.
    6. Enter the {% DateTime.Now %} macro into the dialog and click OK.
    7. Click Save.
    8. Select the NewsTeaser field.
    9. Clear the Display field in the editing form check box.
    10. Click Save.
      Modifying the fields of an alternative form

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)

Creating a News page with a custom Insert alternative form

If you edit an existing News page on the Form tab, the original default editing form is used.

Another example of the usage of page type alternative forms is in the Contribution list web part used by the User contributions feature. In this web part, you can define pages that visitors are allowed to create on the live site.


Was this page helpful?