Introduction and Goals

Events are another method of adding functionality to your Form. There are two types of Events, Set Fields, and Custom that are called from a variety of elements.

Goals

  • Learn when an Event can be called
  • Learn about the different types of Events
  • Incorporate Bridged Resources into Events

Events Video

Events

Events are normally used for either setting field values or adding custom javascript to your forms. In this article we're going to stick to setting field values. A good example of this is adding more detail to a form after a choice is made. We're going to be adding the Contact Name and Email for a site after it's selected on our Cleaning Request form.

Creating Events

Creating Events is done from three places, a Page (when it loads, or is submitted), Fields when their value is changed, and a Button when it's clicked.

The dialog to create the event is the same for all three. Here's the dialog for an Event based on the Site field from the Cleaning Request form.

V5-Site Event Dialog Start

The Type and Action are already set so you can see the options.

Example Form Update

Two fields have also been added to the Form, Site Contact Name and Site Contact Email. They are in a section that you can hide as needed.

Action - Custom

A Custom Event is simply an option to run custom javascript. Add your javascript to the field and it is executed at the point identified by the Type (normally, lLoad or Submit of the Form). This option is better than adding javascript to the Custom Head Content.

Action - Set Fields

Set fields lets you place values into Fields on your Form. It is normally associated with a Bridged Resource, but it isn't required. In our case we are adding more information about the site to the Cleaning Form, so once the Bridged Resource is created, it's a matter of setting information into the Name and contact info fields.

Bridged Resource

The process of creating a Bridged Resource is identical for an Event as for defaults or lists, with one exception. In lists or defaults, you are prompted to Add New of the Bridged Resource doesn't exist. For Events, you need to go directly to the Form Settings and Add a new Bridged Resource there.

Preparing the Bridge Resource:

V5-Form Settings Bridged Resource

Completed Bridged Resource:

V5-Site Info Bridged Resource

There is no Order option because there is only a single return.

Now we're ready for the Event on the Site field.

V5 Site Event Start

Run-If

Setting the Run-If field is an option if you want to restrict when an Event can fire. The Run-If must be a javascript expression that evaluates to true or false (just like a Conditional for a field). In our case we want the Event to fire every time a Site is chosen, so leave the field blank (default to true)

Set Fields Action

Now that all the other Event fields are set, you can set the values for the Set Fields.

Here's an example with one field set and the options for the other field:

V5-Event Set Fields Example

The Values for fields are not limited to one value from the variables dropdown. You can combine static text and multiple variables as needed.

(don't forget to click the + on the right side to save the Field Value mapping)

In the Next Article

This is the end of the 200 level of Front-End topics. Next are some articles on topics for workflow processes.

Story for this Class

The Cleaning Request created in the previous classes is OK, but now we need to improve the User Experience and Workflow.