Add the recordFlexAction JavaScript to the html page

Next, add the recordFlexAction JavaScript to the HTML page

You can copy this code from this page or download the source file here.

function recordFlexAction(json)
{
  var element = document.getElementById(json.id);
  if (element != null)
  {
    element.setAttribute("recordFlexFunctionName", json.functionName);
    if (json.param1 != null)
      element.setAttribute("recordFlexParam1", json.param1);
    else
      element.removeAttribute("recordFlexParam1");
    if (json.param2 != null)
      element.setAttribute("recordFlexParam2", json.param2);
    else
      element.removeAttribute("recordFlexParam2");
    var ev = document.createEvent("Events");
    ev.initEvent("recordFlex", true, false);
    element.dispatchEvent(ev);
  } 
}