Can I use Live Form data in Success/Cancel message form?

  • 26 January 2018
  • 2 replies
  • 1 view

Userlevel 2
Badge +11

Ok, I have a nice working Live Form. What I now need to accomplish is to show data from the Live Form on either the Confirmation or Cancel message page. It allows to insert Properties, but as they either not yet exist while on the Live Form, or are not yet available for other reasons, they show up empty. This includes an automatically generated reference number (intending to use JS and "new Date().getTime()") to be stored in a (hidden/disabled form field).

If the above is possible, what am I missing???

NB: I searched the community but could not find any help so far.


2 replies

Userlevel 2
Badge +11

For now I'm using an alert in the Submit button's Client Click function

Userlevel 2
Badge +11

Ok, another solution is to use either localStorage or sessionStorage. Difference is that the latter is cleared as soon as the browser session is closed while the former behaves similarly to cookies, be it that it allows for more data to be stored. For my purpose it is sufficient to use a sessionStorage variable.

In the form's Custom JavaScript add a line, for example in the Submit button's Client Click function, where you assign your field's value to a sessionStorage variable:

      sessionStorage.myField = NWF$("#" + jsMyField).val();

Next, go into the Live SettingsConfirmation Message and edit the message's HTML source:

  • add a paragraph tag with an id: <p id="myField"></p>
  • At the end add the following JavaScript snippet:

                <script type="text/javascript">

                      document.getElementById("myField").innerHTML = 'The value of myField: ' + sessionStorage.myField;

                </script>

Reply