windowPreHDSubmit Property
[Deprecated] Use HDAPI.RegisterHandler to register for the "PreHDSubmit" event instead.

JavaScript API: Direct
Assembly: api.js Version: 1.0.0.0 (1.0.0.0)
Syntax

JavaScript
var PreHDSubmit

Field Value

Type: function
Remarks

This function (if defined in the global namespace) is called immediately before interview answers are submitted to the host application on the server. This could happen when the user clicks the Finish, Save Answers, or Document Preview buttons, or any other time the HDPostAnswersToServer function is invoked. You can implement this function if you need to add fields, such as the ASP.NET view state, to the form submission.

This callback function was deprecated in HotDocs Server 10.0.2. Although it can still be used, its functionality is now available in a more versatile manner using the HDAPI.RegisterHandler method.

The first parameter, fieldArray, is an associative array containing all the form fields that are about to be submitted to HotDocs Server.

The second parameter, context, is a string indicating the context in which the function was called. It can be one of the following values:

  • InterviewComplete: The user clicked either the Finish button or the Next button at the last dialog.
  • SaveAnswers: The user clicked the Save Answers button.
  • DocumentPreview: The user clicked the Document Preview button.
  • APICall: The HDPostAnswersToServer function has been invoked by some other means.

Examples

The following example adds the current interview location ("bookmark") and ASP.NET view state to the array of data that will be submitted to the server.

JavaScript
function PreHDSubmit(fieldArray, context)
{
    if (context == "InterviewComplete")
    {
        var viewState = document.getElementById("__VIEWSTATE");
        if (viewState)
            fieldArray["__VIEWSTATE"] = viewState.value;
    }
    fieldArray["InterviewBookmark"] = HDGetInterviewBookmark();
}
See Also

Reference