Add fields to a web form adding-fields-to-a-web-form

In a Web form, fields enable users to enter information and select options. Web forms can offer input fields, selection fields, static and advanced content (captchas, subscriptions, etc.).

When you use the assistant to add fields, the field type is detected automatically based on the selected field or storage variable. You can edit it using the Type drop-down box in the General tab.

Page dialog, General tab, with the Type drop-down open to change a field from Combo box to another field type

When using the buttons in the toolbar, select the type of field you want to add.

The following types of field are available:

Please specify the response storage mode: update a field in the database (stores only the last value saved) or store in a variable (the answer is not stored). For more on this, refer to Response storage fields.

NOTE
By default, the field is inserted at the bottom of the current tree. Use the arrows in the toolbar to move it up or down.

Field creation assistant field-creation-assistant

For each page of the form, you can add a field via the first button in the toolbar. To do this, go to the Add using the assistant menu.

Field creation wizard offering Answer a question, Edit a recipient, Add a variable and Import an existing question

Select the type of field you want to create: you can choose to add a field in the database, a variable or to import a group of fields created in another form and collected in a container.

Click Next and select the storage field or variable, or the container you want to import.

Field creation wizard, Edit profile step, with the Salutation database field selected before clicking Finish

Click Finish to insert the selected field into the page.

Page dialog showing the Salutation combo box field inserted in the Welcome page after the wizard

Adding input fields adding-input-fields

To add an input field, click the Input control button and choose the type of field you want to add.

Input control menu listing Text, Number, Password, Multi-line text and HTML text field types

Types of input fields types-of-input-fields

Five different types of text fields can be inserted into a form page:

  • Text: lets the user enter text on one line.

    Rendered text field labeled Your last name containing a one-line value

  • Number: lets the user enter a number on one line. For more on this, refer to Adding numbers.

    When the page is approved, field content is checked to make sure the value entered is compatible with the field. For more on this, refer to Defining control settings.

  • Password: lets the user enter text on a single line. During text entry, the characters are replaced by periods:

    Rendered password field labeled Your password with the typed characters masked as dots

    note caution
    CAUTION
    Passwords are stored unencrypted in the database.
  • Multi-line text: lets the user enter text on several lines.

    Rendered multi-line text field labeled Your message with a scroll bar and a sample text

    note caution
    CAUTION
    Multi-line text fields are specific fields that can contain carriage returns. Their storage space must be associated with a field mapped on an XML element, not an XML attribute.
  • Enriched multi-line text: lets the user enter text with a layout which will be stored in HTML format.

    Rendered enriched text editor with formatting toolbar, bold, links and an inserted image

    You can select the type of editor offered to users. To do this, use the drop-down box of the HTML editor field in the Advanced tab.

    Advanced tab with the HTML editor drop-down listing Minimalist, Basic, Intermediate and Advanced

    The number of icons displayed varies depending on the type of editor. For an Advanced editor, the rendering will be as follows:

    Advanced HTML editor on a form page with full toolbar and the Font Size drop-down open

Configure input fields configure-input-fields

Input fields are all configured based on the same mode, using the following options:

General tab of a Text input field with Label, Mandatory, Storage, Edit storage link and Default value

The General tab lets you enter the name of the field and attribute a default value to it if necessary.

The answer storage mode can be altered via the Edit storage… link. Values can be stored in an existing field of the database; or you can choose not to save information in the database (use a local variable).

NOTE
Storage modes are detailed in Response storage fields

The Advanced tab lets you define display parameters for the field (position of labels, alignment, etc.). See Defining web forms layout.

Adding drop-down lists adding-drop-down-lists

You can insert a drop-down list into a survey page. This lets the user select a value from those on offer in a drop-down menu.

Rendered drop-down list labeled Title offering Mister, Madam and Miss

To add a drop-down box to a form page, click the Selection controls > Drop-down list button in the toolbar of the page editor.

Page editor toolbar menu Selection controls with Combo box, Checkbox, Radio button, Multiple choice, Date, Grid

Select the answer storage mode and confirm your choice.

Define the labels and values of the list in the lower section of the General tab. If the information is stored in an existing field of the database and it is an enumeration field, you can fill in the values automatically by clicking Initialize the list of values from the database , as shown below:

Combo box General tab with the Initialize the list of values from the database link and the filled list

NOTE
Use the arrows to the right of the list of values to change their sequence.

If the data is stored in a linked table, you can select the field where the values to be suggested in the list are saved. For example, if you select the table of countries, click Initialize the list of values from the database… and select the desired field.

Web application dialog to pick the Label field from the Country table, with the Select an expression dialog

Next, click the Load link to retrieve the values:

Web application dialog after clicking Load, with a Preview list of country labels and values

CAUTION
Repeat this operation whenever the list is updated to refresh the values on offer.

Adding checkboxes adding-checkboxes

In order for the user to select an option, you need to use a checkbox.

Rendered checkbox, checked, with the label I want to receive your newsletter

To add a checkbox to a form, click the Selection controls > Checkbox… icon in the toolbar of the page editor.

Select the answer storage mode and confirm your choice.

Enter the label of the box in the Label field of the General tab.

Checkbox General tab with Label, Storage, Selected by default, Value and Empty value fields

A checkbox lets you assign a value to the storage field (or value) depending on whether or not the box is checked. The Values section lets you enter the value to assign if the box is checked (in the Value field), and the value to assign if it is not checked (in the Empty value field). These values depend on the data storage format.

If the storage field (or variable) is boolean, the value to assign if the box is not checked will be deduced automatically. In this case, only the Value if checked field is offered, as shown below:

Checkbox General tab for a boolean field, with only the Value if checked drop-down offering Yes and No

Example: Assign a value to a field if a box is checked example--assign-a-value-to-a-field-if-a-box-is-checked

We want to insert a checkbox into a form to send a maintenance request, as shown below:

Rendered form page with a Product drop-down, a shipping Date field and a checked Maintenance required box

The information will be uploaded to the database and into an existing field (in this case, the Comment field):

Recipient list with a Comment column showing Maintenance required or Maintenance not required

If the “Maintenance required” box is checked, the Comment column will contain “Maintenance required”. If the box isn’t checked, the column will show “Maintenance not required”. To obtain this result, apply the following configuration to the checkbox on the form page:

Maintenance required checkbox stored in the comment field, with Value and Empty value texts

Adding radio buttons adding-radio-buttons

Radio buttons let you offer the user a series of exclusive options to choose from. These are different values for the same field.

Rendered radio buttons Mister, Madam and Miss, with Madam selected

You can create radio buttons individually (unitary buttons) or via a multiple-choice list, but since the point of the radio buttons is to select one option or another, we will always create at least a pair of radio buttons, never just a single button.

CAUTION
To make selection mandatory, you need to create a multiple choice list.

Add single buttons add-single-buttons

To add a radio button to a form page, go to the Selection controls > Radio button menu in the toolbar of the page editor and choose a storage mode.

General tab of a Radio button field with Label Option 1, Variable storage, Selected by default and Value

Radio buttons are configured in a similar way to checkboxes (see Adding checkboxes). However, no value is assigned if the option is not selected. In order for several buttons to be interdependent, i.e. selecting one automatically deselects the others, they must be stored in the same field. If they are not stored in the database, the same local variable must be used for temporary storage. See Response storage fields.

Add a list of buttons add-a-list-of-buttons

To add radio buttons via a list, go to the Selection controls>Multiple choice menu in the toolbar of the page editor.

Multiple choice field General tab listing Option 1 to Option 3 with value, Selected and Score columns

Add as many radio buttons as there are labels. The advantage of this feature is that you can import values from an existing field (in case of an itemized field) and make it possible for the user to choose one option. However, the layout of buttons is less flexible.

NOTE
You cannot enable multi-selection in a web application.
It is possible, however, to insert a Multiple choice type field into a Web application but this will not enable the user to select several values.

Adding grids adding-grids

Grids are used to design voting pages in Web applications. This lets you offer lists of radio buttons for answering survey or assessment type Web forms, as shown below:

Rendered rating grid with Video 1 to Video 3 rows and radio buttons from 1 poor to 5 excellent

To use this type of element in a form, create a simple grid and add a line for each element to be assessed.

Page editor with a Notes simple grid and three grid lines, Video 1 to Video 3, and rating values 1 to 5

The number of radio buttons in each line of the grid matches the number of values defined in the simple grid.

Rendered grid with a simple grid header row 1 to 5 and three grid lines, one radio button chosen per line

Only one option can be selected per grid line.

NOTE
In our example, the label of the grid is hidden. To do this, go to the Advanced tab, the Label position display is defined as Hidden . See Defining the position of labels.

Adding dates and numbers adding-dates-and-numbers

The content of the form fields can be formatted to match the data stored in the database or to satisfy a particular requirement. You can create suitable fields for the entry of numbers and dates.

Adding dates adding-dates

Date field with the calendar picker open on January 2017 and a day selected

To allow the user to enter a date in a form page, add an input field and select the type Date….

Enter a label for the field and configure the data storage mode.

General tab of a Birth date field of type Date, with Date format and Time format drop-downs

The lower section of the window lets you select the date and time formats for the values stored in this field.

Date format drop-down listing formats such as 12/31/12, 31 December 2012 and December 31, 2012

You can also choose not to display the date (or time).

Dates can be selected via a calendar or drop-down boxes. You can also enter them directly in the field, but they need to match the format specified in the screen above.

NOTE
By default, dates used in forms are entered via a calendar. For multilingual forms, please check that calendars are available in all the languages used. See Translating a web form.

However in some cases, (for entering dates of birth, for instance) it may be easier to use drop-down lists.

Rendered Birth date field using three drop-down lists for day, month and year

To do this, click the Advanced tab and choose the input mode using Drop-down lists.

Advanced tab with the Input mode drop-down set to choose Date input using a calendar or Drop-down lists

You can then set limits to the values offered in the list.

Date field General tab with First year and Last year boxes limiting the years offered in the lists

Adding numbers adding-numbers

You can create suitable fields for the entry of numbers.

Rendered numeric field labeled Points containing the value 2 500

In a numeric field, the user can enter numbers only. Entry control is applied automatically when the page is approved.

Depending on the field in which data is stored in the database, special formatting or certain restrictions may be applied. You can also specify maximum and minimum values. This type of field is configured as follows:

Number field General tab with Default value, Minimum value and Maximum value approval options

The default value is the value displayed in the field when the form is published. It can be corrected by the user.

You can add a prefix and/or suffix to the numeric field via the Advanced tab, as shown below:

Advanced tab of a number field with Prefix set to You have and Suffix set to points

In the form, the rendering will be as follows:

Rendered numeric field showing the prefix You have, the value 10 and the suffix points

Subscription checkboxes subscription-checkboxes

You can add controls to allow users to subscribe to or unsubscribe from one or more information services (newsletters, warnings, real-time notifications, etc.). To subscribe, the user checks the corresponding service.

To create a subscription checkbox, click Advanced controls>Subscription.

Subscription field General tab with the Service drop-down listing information services to select

Indicate the label for the checkbox and select the information service concerned using the Service drop-down box.

NOTE
Information services are detailed in this page.

The user subscribes to the service by checking the relevant option.

Rendered Confirm Profile and Select Newsletters form with newsletter checkboxes and a Validate button

CAUTION
If the user is already subscribed to an information service and the box linked to this service isn’t checked when they approve the form, they will be unsubscribed.

Inserting a captcha inserting-a-captcha

The purpose of captcha tests is to prevent fraudulent use of your Web forms.

CAUTION
If your form contains several pages, the Captcha must always be placed on the last page, just before the storage box, to prevent any circumvention of the security measures.

To insert a Captcha into a form, click the first button on the toolbar and select Advanced controls>Captcha.

Advanced controls toolbar menu listing File, Subscription, Constant and Captcha, with Captcha highlighted

Enter the label of the field. This label will be displayed in front of the Captcha display area. You can change the position of this label in the Advanced tab.

Captcha Advanced tab with the Label position drop-down offering Inherited, Left, Right, Above, Below, Hidden

NOTE
For captcha type controls, there is no need to indicate a storage field or variable.

The Captcha is inserted into the page with an input field placed under the visual. These two elements are inseparable and are considered as a single item for the purpose of page layout (they occupy a single cell).

Rendered form page with a captcha image of distorted characters and an input field underneath

When the page is confirmed, the input field is displayed in red if the content of the Captcha was not entered correctly.

Form page showing a red error message that the characters entered must match the captcha image

You can create an error message to display. To do that, use the Personalize the message link in the General tab.

Captcha General tab with the Personalize the message link opening the Message personalization dialog

NOTE
Captchas are always 8 characters long. You cannot modify this value.

Uploading a file uploading-a-file

You can add an upload field to a page. This functionality can be useful for intranet file sharing, for instance.

Rendered upload field labeled Upload your picture with a Browse button

To insert an upload field to a form page, select the Advanced controls > File… menu in the toolbar of the page editor.

By default, the uploaded files are stored in resource files accessible via the Resources > Online > Public resources menu. You can use a script to change this behavior. This script can use the functions defined in Campaign JSAPI documentation, including those that concern file manipulation.

You can store the link to these files in a local variable or in a database field. For example, you can extend the recipient schema to add a link to file-based resources.

CAUTION
  • This type of file must be reserved for forms with secure access (using credentials).
  • Adobe Campaign does not control the size or the type of resource uploaded: we therefore highly recommend using upload fields for secure type intranet sites only.
  • If several servers are linked to the instance (load balancing architecture), you need to make sure calls to the Web form arrive on the same server.
  • These implementations require the assistance of the Adobe Campaign Consulting team.

Inserting a hidden constant inserting-a-hidden-constant

When the user validates one of the pages of the form, you can set a specific value to a field of their profile or to a variable.

This field is not visible to the user, but can be used to enrich the data in the user profile.

To do this, place a constant in the page and specify the value and the storage location.

In the following example, the origin field of the recipient profile is filled in automatically whenever a user approves this page. The constant is not displayed on the page.

Constant field named Origin, stored in the origin database field, with the Value External

recommendation-more-help
campaign-help-v8