How Do I Get the TrustedForm Script to Capture Its Snapshot At a Particular Point In The User Experience?

Timing execution of the TrustedForm script to capture the web page in a particular state

To capture a TrustedForm snapshot of the page HTML as it exists at a particular time in the user's experience, instead of when it is first loaded by the user's browser may require departing slightly from the default method of placing and running the TrustedForm script. Here's a method that works well in many instances:


First, wrap the standard TrustedForm script in a function that allows us to call/load the script when we need it. Place this outside the document-ready function, and remove the original placement of the script. Here is the wrapped version:


    function loadTrustedForm() {
Insert the contents of the TrustedForm script - whatever is between the <script type="text/javascript"> and </script> tags - here.


Then, call loadTrustedForm() at the desired point in the user experience, when the page HTML is in the desired condition instead of when the page first loads.


It should be noted that the TrustedForm Snapshot will capture the values of page elements if they are set in the page html. This may not include user-entered data that resides only in browser memory. To capture user-entered data in the snapshot it may be necessary for your web programmer to construct a script that writes those values into the HTML prior to calling loadTrustedForm().

Currently, the way TrustedForm snapshots a page is by reading the DOM. However, the DOM doesn't include in-memory values for <input> fields. We're working on a patch to fix this. In the mean time, you can code your page to set the DOM value to the user's input value. That'll make it so text inputs appear in the TF Snapshot. There are numerous ways your web developer can code this, but here's a sample jquery snippet that will do that when placed in the page's initialization routine. 

Was this article helpful?
0 out of 4 found this helpful
Have more questions? Submit a request


  • Avatar
    Dustin Hansen

    Where is the sample jquery snippet mentioned in the article?

You must be logged in to comment.