Legacy API
The legacy HotDocs Server JavaScript API, constituted of global functions and variables, has been deprecated in HotDocs Server 11 and HotDocs Cloud Services. The functions and variables are still present and functional for purposes of backwards compatibility, but new or updated integrations should use the HDAPI and HDInterviewOptions objects instead.

JavaScript API: Direct
Assembly: api.js Version: (

Direct.window = function();


The window type exposes the following members.


Public methodHDAddCustomNavButton
This function adds a button to the interview navigation bar. When a user clicks the button, a JavaScript function is called that performs any action users may need to take while navigating through the interview.
Public methodCode exampleHDAddCustomToolbarButton
This function adds a button to the interview toolbar. When a user clicks the button, a JavaScript function is called that performs any action you may wish to make available to users of your host application, such as displaying your host application's help file.
Public methodHDAnsGetIter
This function returns a single number value that represents the repeat index (1-based) of the current dialog. This is different than HDAPI.GetAnswerRepeatIndex, which is 0-based and returns a complete set of four indexes. As such, GetAnswerIterator is most useful for non-nested repeats where there is only one index that matters.
Public methodCode exampleHDAnsGetRptNdx
This function returns the full set of repeat indexes for the current dialog. When using HDAPI.GetAnswer and HDAPI.SetAnswer with repeated dialogs, this function allows you to get or set the values of variables in the current repetition.
Public methodHDAnsGetVal
This function gets the answer value for a variable. It can also get a single (indexed) value from a repeated answer.
Public methodHDAnsSetVal
This function sets the answer value for a variable. It can also set a single (indexed) value in a repeated answer.
Public methodHDEncodeString
Base64-encodes a string of text. Supports internal encoding in UTF-8 or UTF-16.
Public methodHDGetAnswerSummary
Returns a summary of answers from the interview in HTML format.
Public methodCode exampleHDGetInterviewBookmark
This function returns a string (up to 70 characters in length) that represents the user's current location in the interview, including the input field that contains the focus. For example, you can call this function from your handler for the PreHDSubmit event, in order to submit a bookmark for the user's current location to the server along with the user's answers. Later, you would use the HDAPI.GotoInterviewBookmark function to return the user to that same location in the interview.
Public methodHDGetXMLAnswers
This function returns an XML string of answers from the current interview. For example, you could use this string to overlay the current interview's answers on top of an existing answer file, thus updating the answer file with any answers that have been entered during the interview.
Public methodCode exampleHDGotoInterviewBookmark
This function navigates the user to a specific dialog in the interview, and moves the focus to a designated field within that dialog. If the bookmark is invalid, or the location is no longer part of the interview, no navigation takes place.
Public methodHDInvokeButton
This method invokes the 'OnClick' function for one of the toolbar or navigation bar buttons (either built-in or custom), even if the button has been hidden. For example, if you create your own "Finish" button, you may want to hide the built-in "Finish" button but still have your custom button perform the same action by invoking the 'OnClick' function for the hidden "Finish" button.
Public methodHDPostAnswersToServer
This function posts the current answer collection from the interview to the server. The browser interview calls this function internally when the user clicks the Save Answers button during the interview. It may also be invoked from 3rd party code, if (during the course of an interview) you need to post the current answer set to some URL and (optionally) display a server-returned response to the user.
Public methodHDPostToServer
This method posts information to the server. It is used by the HDAPI.PostAnswersToServer method for posting answers to the server, but you could use it to post any other kind of information. For example, if your host application can generate some sort of custom summary page, this function could post data to that page and display the response to the user (in the context of the intervew).
Public methodHDRegisterHandler
This function is used to register event handlers for various interview events. They can be used for both JavaScript and Silverlight interviews. If necessary the event handler can later be unregistered using the HDAPI.UnregisterHandler function.
Public methodCode exampleHDScreenRefresh
This function refreshes the screen to update answers in the variable fields that have changed.
Public methodHDServerResponseVisible
This function returns a value indicating whether or not the modal server response is currently visible or not. If the server response is visible, all the input fields of the interview are currently obscured and unavailable for interaction, and other API functions (such as InvokeButton) will not function.
Public methodCode exampleHDSetButtonVisibility
This function lets callers hide individual buttons on the toolbar or navigation bar. It can also be used to hide the entire toolbar or navigation bar.
Public methodHDSetNavButtonImage
This function sets the image to use for navigation bar buttons.
Public methodHDSetTemplateTitle
This function sets the template title that appears in the toolbar.
Public methodHDSetToolbarButtonImage
This function lets callers specify alternate images for built-in toolbar buttons. It should be called before the toolbar is rendered for the first time, such as in the HDInterviewOptions.OnInit method.
Public methodHDSubmitAns
[Deprecated] This function calls the "Finish" action on the interview, which submits answers to the server.
Public methodHDUnregisterHandler
This function is used to unregister an event handler for an interview event that was previously registered using the HDAPI.RegisterHandler function.

Public fieldHDBottomMargin
The number of pixels to reserve below the browser interview when HDInterviewOptions.Height (or formerly, HDInterviewHeight) is set to "auto" and the actual height of the interview's HTML DIV is being calculated. Irrelevant when HDInterviewOptions.Height is set to anything other than "auto".
Public fieldCode exampleHDDisableBrowserWarning
By default HotDocs browser interviews display a warning during interview initialization if an unsupported browser or operating system is detected. Setting this variable to true suppresses that warning.
Public fieldHDDisableFinishWarning
When set to true, suppresses the browser interview's default behavior of warning the user before he or she submits an interview accidentally or which may be in an incomplete state. (The default value is false.)
Public fieldHDDisableOnSubmit
This determines whether or not buttons, input fields, and other controls on the interview are disabled (by overlaying them with a translucent HTML DIV) when answers are being submitted to the server. The default is true.
Public fieldHDInterviewHeight
The requested height of the HotDocs browser interview. If not specified, the default value is "auto" (see Remarks below).
Public fieldHDInterviewLocale
The name of the language module that will be loaded and used by HotDocs when presenting this interview. Browser language modules dictate date and number formatting, calendars, all built-in user interface text, etc. The name is formed by combining a two-letter language code with a regional code; If no value is specified, the default is "en-US" (US English).
Public fieldHDInterviewOutlineWidth
Specifies the initial width (in pixels) for the interview outline component of the interview outline.
Public fieldHDInterviewWidth
The requested width of the HotDocs browser interview. If not specified, the default value is "auto" (see Remarks below).
Public fieldHDLeaveWarning
Specifies whether the end user will be warned if they try to close or navigate away from the interview page without submitting their answers to the host application.
Public fieldHDRequiredAsterisk
Specifies whether an asterisk will be appended to the prompt of any variable for which a value is always required. Such prompts are normally highlighted in an alternate color (as dicatated by the interview style sheet) until they have been answered, but this option causes asterisks to be shown as well (even after the variables have been answered). Defaults to false.
Public fieldHDResourcePaneHeight
Specifies the initial height (in pixels) of the resource pane. Defaults to 100 if not specified.
Public fieldOnHDFinish
[Deprecated] Use HDAPI.RegisterHandler to register for the "OnHDFinish" event instead.
Public fieldCode exampleOnHDStart
[Deprecated] Use HDAPI.RegisterHandler to register for the "OnHDStart" event instead.
Public fieldCode examplePreHDRender
[Deprecated] Use HDInterviewOptions.OnInit instead. This function is called before HotDocs builds the interview. You can use this function to perform any interview preprocessing, such as adding custom buttons to the interview toolbar or registering for interview events.
Public fieldCode examplePreHDSubmit
[Deprecated] Use HDAPI.RegisterHandler to register for the "PreHDSubmit" event instead.
See Also