Toggle menu

Default Functions

A field's default function can be used to set its initial value. The JavaScript is executed server-side when the field's HTML is generated (and again when things like emails are generated). You can use a default function to execute any JavaScript, including calling end points and other services.

The function's parameters are:

  1. helper - The helper library
  2. defaultValue - The field's default value (usually what's entered into the "Default" property in the forms designer
  3. currentValue - The current value of the field

In this example the function checks for a currentValue, and if the field already has one, it won't be overwritten by the function.