Contact Form API

The following API allows you to specify values that will populate the contact form when it's opened. It includes hidden values* that will be visible in the ticket details in your inbox (for representatives).

_nRepData["formValues"] = new Array();

Then add each value using the following syntax; replacing name and value with your desired information:

_nRepData["formValues"].push(["name", "value"]);

*For the values to appear in the Contact Form input boxes, the specified name must match the name of the field in the Contact-Form configuration (commonly used names are Email_Address, Message_Body). These values are called visible values since they are visible to the user.

If the specified name does not match an existing UI input box, the value will not be visible to the user, and will be silently added to the ticket's details. Once added, it will be visible in your inbox (we call these values hidden values).

Remember: You can add any and as many values as you require for processing your ticket effectively.


To illustrate how to set 2 values to a contact form (1 visible and 1 hidden), we take as an example a contact form with 2 fields: an e-mail address and a details box.

To automatically set the user's email address and add his user ID to the ticket, the following lines are added:

_nRepData["formValues"] = new Array();
_nRepData["formValues"].push(["Email_Address", ""]);
_nRepData["formValues"].push(["userId", "1234567890"]);

Please notice that appears in the e-mail field in the contact form. However, the user ID value will not appear in the UI but will be available in the ticket details in your inbox.

The final script looks like this:

< script type = 'text/javascript' >
    var _nRepData = _nRepData || [];
//API here 
_nRepData["formValues"] = new Array(); _nRepData["formValues"].push(["Email_Address", ""]); _nRepData["formValues"].push(["userId", "1234567890"]);
(function() {
    var windowLoadFunc = function() {
        var _nRepData = window._nRepData || [];
        _nRepData['windowLoaded'] = true;
        if (typeof(_nRepData['windowOnload']) === 'function') _nRepData['windowOnload']();
    if (window.attachEvent) window.attachEvent('onload', windowLoadFunc);
    else if (window.addEventListener) window.addEventListener('load', windowLoadFunc, false);
    var sc = document.createElement('script');
    sc.type = 'text/javascript';
    sc.async = true;
    sc.defer = true;
    sc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + '';
    var _head = document.getElementsByTagName('head')[0];
})(); < /script >