Feature Snapshot
Summary:
TrustedForm Callback Functions are custom global JavaScript functions that are automatically invoked by the TrustedForm script immediately after it inserts certificate data (such as the certificate ID and certificate URL) into your forms. This allows you to trigger additional custom actions, integrations, or validations as soon as the certificate is generated.
Key Benefits:
- Provides a hook to automatically process or log certificate data immediately after it is generated.
- Enhances integration flexibility by allowing custom UI updates, analytics events, or lead matching actions to occur seamlessly.
- Ensures a one‑time, predictable execution per certificate injection to avoid duplicate processing.
Typical Use Cases:
- Displaying a pop-up or visual notification to confirm that a certificate has been generated during testing.
- Logging certificate identifiers and URLs especially if they can not be appended to a form.
How the TrustedForm Callback Functions Work
When the TrustedForm Certify Web SDK loads on your page, it automatically looks in the global scope for specific callback functions named trustedFormCertIdCallback (for the certificate ID) and trustedFormCertUrlCallback (for the full certificate URL). If these functions are defined, the script passes the corresponding certificate data to them immediately after inserting hidden fields into your form. This process occurs only once per certificate generation, even if multiple forms exist on the page.
Step‑by‑Step Instructions
-
Define global callback functions in your page’s JavaScript. For example:
<script type="text/javascript"> // Function to receive the TrustedForm Certificate ID function trustedFormCertIdCallback(certificateId) { // Custom action: alert or log the certificate ID alert("Certificate ID: " + certificateId); console.log("Received Certificate ID:", certificateId); } // Function to receive the full TrustedForm Certificate URL function trustedFormCertUrlCallback(certificateUrl) { // Custom action: alert or process the certificate URL alert("Certificate URL: " + certificateUrl); console.log("Received Certificate URL:", certificateUrl); } </script> -
Ensure these functions are placed in the global scope and declared before you load the TrustedForm core JavaScript snippet.
-
Insert the TrustedForm script into your form page (typically just before the closing
Comments
0 comments
Please sign in to leave a comment.