hub.eb?material_id=275

Before Form Event


The Before Form event is triggered at the very start of the lifecycle of a Form. This event is only triggered the first time an end-user navigates to the Form.

Here are a few examples of things you might do:

  • Fetch data used across the whole Form.
  • Set up some preliminary data.
  • Process URL parameters.
  • Check end-user security settings.
  • Redirect the user to a different Page other than the first.
  • Redirect the user to a different Form, for example, a login page.

Note that the Before Form event is triggered before any Pages, so no interaction with Pages, or any of their Controls, is not possible.

Steps


1

Create a Form and add a Field called myField. Drag the Field onto the Page.

2

Open the Form Properties dialog and select the Events tab. Under Before Form, click the button to create a new Script. Name the script setMyField.

3

Add the following to the new setMyField script:

fields.myField.value = "Hello, world.";
4

Return to the Form and run it.

myField was set during the Before Form event and is showing in the browser.

Part of tracks

Related