# Edit forms{#editing-forms} ![](/docs/campaign-classic/assets/common.svg?lang=en) ## Overview Marketers and operators use input forms to create, modify, and preview records. Forms show a visual representation of information. You can create and modify input forms: * You can modify the factory input forms that are delivered by default. The factory input forms are based on the factory data schemas. * You can create custom input forms, based on data schemas that you define. Forms are entities of `xtk:form` type. You can view the input form structure in the `xtk:form` schema. To view this schema, choose **Administration** > **Configuration** > **Data schemas** from the menu. Read more about [form structure](/docs/campaign-classic/using/configuring-campaign-classic/input-forms/form-structure.html?lang=en). To access input forms, choose **Administration > Configuration > Input forms** from the menu: ![](/docs/campaign-classic/assets/d_ncs_integration_form_arbo.png?lang=en) To design forms, edit the XML content in the XML editor: ![](/docs/campaign-classic/assets/d_ncs_integration_form_edit.png?lang=en) [Read more](/docs/campaign-classic/using/configuring-campaign-classic/input-forms/form-structure.html?lang=en#formatting). To preview a form, click the **Preview** tab: ![](/docs/campaign-classic/assets/d_ncs_integration_form_preview.png?lang=en) ## Form types You can create different types of input forms. The form type determines how users navigate the form: * Console screen This is the default form type. The form comprises a single page. ![](/docs/campaign-classic/assets/console_screen_form.png?lang=en) * Content Management Use this form type for content management. See this [use case](/docs/campaign-classic/using/sending-messages/content-management/use-case--creating-content-management.html?lang=en). ![](/docs/campaign-classic/assets/d_ncs_content_form13.png?lang=en) * Wizard This form comprises multiple floating screens that are ordered in a specific sequences. Users navigate from one screen to the next. [Read more](/docs/campaign-classic/using/configuring-campaign-classic/input-forms/form-structure.html?lang=en#wizards). * Iconbox This form comprises multiple pages. To navigate the form, users select icons at the left of the form. ![](/docs/campaign-classic/assets/iconbox_form_preview.png?lang=en) * Notebook This form comprises multiple pages. To navigate the form, users select tabs at the top of the form. ![](/docs/campaign-classic/assets/notebook_form_preview.png?lang=en) * Vertical pane This form shows a navigation tree. * Horizontal pane This form shows a list of items. ## Containers In forms, you can use containers for various purposes: * Organize content within forms * Define access to input fields * Nest forms within other forms [Read more](/docs/campaign-classic/using/configuring-campaign-classic/input-forms/form-structure.html?lang=en#containers). ### Organize content Use containers to organize content within forms: * You can group fields into sections. * You can add pages to multipage forms. To insert a container, use the `` element. [Read more](/docs/campaign-classic/using/configuring-campaign-classic/input-forms/form-structure.html?lang=en#containers). #### Group fields Use containers to group input fields into organized sections. To insert a section into a form, use this element: ``. Optionally, to add a section title, use the `label` attribute. Syntax: ` […] ` In this example, a container defines the **Creation** section, which comprises the **Created by** and **Name** input fields: ```xml
``` ![](/docs/campaign-classic/assets/console_screen_form.png?lang=en) #### Add pages to multipage forms For multipage forms, use a container to create a form page. This example shows containers for the **General** and **Details** pages of a form: ```xml […] […] ``` ### Define access to fields Use containers to define what is visible and to define access to fields. You can turn on or off groups of fields. ### Nest forms Use containers to nest forms within other forms. [Read more](#add-pages-to-multipage-forms). ## References to images To find images, choose **Administration** > **Configuration** > **Images** from the menu. To associate an image with an element in the form, for example, an icon, you can add a reference to an image. Use the `img` attribute, for example, in the `` element. Syntax: `img="`*`namespace`*`:`*`filename`*`.`*`extension`*`"` This example shows references to the `book.png` and `detail.png` images from the `ncm` namespace: ```xml […] […] ``` These images are used for icons that users click to navigate a multipage form: ![](/docs/campaign-classic/assets/nested_forms_preview.png?lang=en) ## Create a simple form {#create-simple-form} To create a form, follow these steps: 1. From the menu, choose **Administration** > **Configuration** > **Input forms**. 1. Click the **New** button at the top right of the list. ![](/docs/campaign-classic/assets/input-form-create-1.png?lang=en) 1. Specify the form properties: * Specify the form name and the namespace. The form name and the namespace can match the related data schema. This example shows a form for the `cus:order` data schema: ```xml
``` Alternatively, you can explicitly specify the data schema in the `entity-schema` attribute. ```xml
``` * Specify the label to be displayed on the form. * Optionally, specify the form type. If you do not specify a form type, the console screen type is used by default. ![](/docs/campaign-classic/assets/input-form-create-2.png?lang=en) If you are designing a multipage form, you can omit the form type in the `
` element and specify the type in a container. 1. Click **Save**. 1. Insert the form elements. For example, to insert an input field, use the `` element. Set the `xpath` attribute to the field reference as an XPath expression. [Read more](/docs/campaign-classic/using/configuring-campaign-classic/schema-reference/schema-structure.html?lang=en#referencing-with-xpath). This example shows input fields based on the `nms:recipient` schema. ```xml ``` 1. If the form is based on a specific schema type, you can look up the fields for this schema: 1. Click **Insert** > **Document fields**. ![](/docs/campaign-classic/assets/input-form-create-4.png?lang=en) 1. Select the field and click **OK**. ![](/docs/campaign-classic/assets/input-form-create-5.png?lang=en) 1. Optionally, specify the field editor. A default field editor is associated with each data type: * For a date-type field, the form shows an input calendar. * For an enumeration-type field, the form shows a selection list. You can use these field editor types: | Field editor | Form attribute | | --- | --- | | Radio button | `type="radiobutton"` | | Checkbox | `type="checkbox"` | | Edit tree | `type="tree"` | Read more about [memory list controls](/docs/campaign-classic/using/configuring-campaign-classic/input-forms/form-structure.html?lang=en#memory-list-controls). 1. Optionally, define access to the fields: | Element | Attribute | Description | | --- | --- | --- | | `` | `read-only:"true"` | Provides read-only access to a field | | `` | `type="visibleGroup" visibleIf="`*edit-expr*`"` | Conditionally displays a group of fields | | `` | `type="enabledGroup" enabledIf="`*edit-expr*`"` | Conditionally enables a group of fields | Example: ```xml […] […] ``` 1. Optionally, use containers to group fields into sections. ```xml ``` ![](/docs/campaign-classic/assets/input-form-create-3.png?lang=en) ## Create a multipage form {#create-multipage-form} You can create multipage forms. You can also nest forms within other forms. ### Create an `iconbox` form Use the `iconbox` form type to show icons at the left of the form, which take users to different pages in the form. ![](/docs/campaign-classic/assets/iconbox_form_preview.png?lang=en) To change the type of an existing form to `iconbox`, follow these steps: 1. Change the `type` attribute of the `` element to `iconbox`: ```xml ``` 1. Set a container for each form page: 1. Add a `` element as a child of the `` element. 1. To define a label and an image for the icon, use the `label` and `img` attributes. ```xml […] […] […] ``` Alternatively, remove the `type="frame"` attribute from the existing `` elements. ### Create a `notebook` form Use the `notebook` form type to show tabs at the top of the form, which take users to different pages. ![](/docs/campaign-classic/assets/notebook_form_preview.png?lang=en) To change the type of an existing form to `notebook`, follow these steps: 1. Change the `type` attribute of the `
` element to `notebook`: ```xml ``` 1. Add a container for each form page: 1. Add a `` element as a child of the `` element. 1. To define the label and the image for the icon, use the `label` and `img` attributes. ```xml […] […] […] ``` Alternatively, remove the `type="frame"` attribute from the existing `` elements. ### Nest forms {#nest-forms} You can nest forms within other forms. For example, you can nest notebook forms within iconbox forms. The level of nesting controls navigation. Users can drill down to subforms. To nest a form within another form, insert a `` element and set the `type` attribute to the form type. For the top-level form, you can set the form type in an outer container or in the `
` element. ### Example This example shows a complex form: * The top-level form is an iconbox form. This form comprises two containers labelled **General** and **Details**. As a result, the outer form shows the **General** and **Details** pages at the top level. To access these pages, users click the icons at the left of the form. * The subform is an notebook form that is nested within the **General** container. The subform comprises two containers that are labelled **Name** and **Contact**. ```xml
``` As a result, the **General** page of the outer form shows the **Name** and **Contact** tabs. ![](/docs/campaign-classic/assets/nested_forms_preview.png?lang=en) ## Modify a factory input form {#modify-factory-form} To modify a factory form, follow these steps: 1. Optionally, extend the related data schema: 1. From the menu, choose **Administration** > **Configuration** > **Data schemas**. 1. Select a data schema and extend it. For example, you can add fields. [Read more](/docs/campaign-classic/using/configuring-campaign-classic/editing-schemas/extending-a-schema.html?lang=en).

Do not modify the original data in a factory namespace, but, instead, extend it in a custom namespace. The reason is that, during software upgrades, all data in the factory namespaces are overwritten. For example, the data in the xtk, ncm, and nms factory namespaces are overwritten. The data in your custom namespaces is not modified.

1. Modify the factory input form: 1. From the menu, choose **Administration** > **Configuration** > **Input forms**. 1. Select an input form and modify it. You can extend factory data schemas, but you cannot extend factory input forms. We recommend that you modify factory input forms directly without recreating them. During software upgrades, your modifications in the factory input forms are merged with the upgrades. If the automatic merge fails, you can resolve the conflicts. [Read more](/docs/campaign-classic/using/monitoring-campaign-classic/updating-adobe-campaign/upgrading.html?lang=en#resolving-conflicts). For example, if you extend a factory schema with an additional field, you can add this field to the related factory form. ## Validate forms {#validate-forms} You can include validation controls in forms. ### Grant read-only access to fields To grant read-only access to a field, use the `readOnly="true"` attribute. For example, you might want to show the primary key of a record, but with read-only access. [Read more](/docs/campaign-classic/using/configuring-campaign-classic/input-forms/form-structure.html?lang=en#non-editable-fields). In this example, the primary key (`iRecipientId`) of the `nms:recipient` schema is displayed in read-only access: ```xml ``` ### Check mandatory fields You can check mandatory information: * Use the `required="true"` attribute for the required fields. * Use the `` node to check these fields and show error messages. In this example, the email address is required, and an error message is displayed if the user has not provided this information: ```xml The email address is required. ``` Read more about [expression fields](/docs/campaign-classic/using/configuring-campaign-classic/input-forms/form-structure.html?lang=en#expression-field) and [form context](/docs/campaign-classic/using/configuring-campaign-classic/input-forms/form-structure.html?lang=en#context-of-forms). ### Validate values You can use JavaScript SOAP calls to validate form data from the Console. Use these calls for complex validation, for example, to check a value against a list of authorized values. [Read more](/docs/campaign-classic/using/configuring-campaign-classic/input-forms/form-structure.html?lang=en#soap-methods). 1. Create a validation function in a JS file. Example: ```js function nms_recipient_checkValue(value) { logInfo("checking value " + value) if (…) { logError("Value " + value + " is not valid") } return 1 } ``` In this example, the function is named `checkValue`. This function is used to check the `recipient` data type in the `nms` namespace. The value that is being checked is logged. If the value is not valid, then an error message is logged. If the value is valid, then the value 1 is returned. You can use the returned value to modify the form. 1. In the form, add the `` element to the `` element. In this example, a SOAP call is used to validate the `@valueToCheck` string: ```xml
``` In this example, the `checkValue` method and the `nms:recipient` service are used: * The service is the namespace and the data type. * The method is the function name. The name is case-sensitive. The call is performed synchronously. All exceptions are displayed. If you use the `` element, then users cannot save the form until the entered information is validated. This example shows how you can make service calls from within forms: ```xml ``` In this example, the input is an ID, which is a primary key. When users fill the form for this ID, a SOAP call is made with this ID as the input parameter. The output is a boolean that is written to this field: `/tmp/@count`. You can use this boolean inside the form. Read more about [form context](/docs/campaign-classic/using/configuring-campaign-classic/input-forms/form-structure.html?lang=en#context-of-forms).

On this page