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 thecam-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 anycam-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.
$scope in the variables-fetched callback and read the values from the $scope in the submit callback: