Skip to main content
It is possible to participate in the lifecycle of the form. See Form Lifecycle and Events for more details.

Fetching Additional Variables

When loading the form, the values of all variables used in the form are fetched from the backend. This means that the form SDK only fetches those variables which are actually used in the form. The most convenient way to use a variable is the cam-variable-name directive. However, there are some situations where directive-based usage is inconvenient. In such situations it is useful to declare additional variables programmatically:

Submitting Additional Variables

Similar to fetching additional variables using a script, it is also possible to add additional variables to the submit:

Implementing Custom Fields

The following is a small usage example which combines some of the features explained so far. It uses custom JavaScript to implement a custom interaction with a form field which does not use any cam-variable-* directives. It shows how custom scripting can be used for
  • declaring a variable to be fetched from the backend,
  • writing the variable’s value to a form field,
  • reading the value upon submit.
The above example uses jQuery for interacting with the HTML controls. If you use AngularJS, you can also populate the $scope in the variables-fetched callback and read the values from the $scope in the submit callback: