Skip to the content

Renderer custom initialization

eForms Renderer consists from the div container and it's content (canvas and hidden input). Hidden input named "eFormsHubUrl" holds url of the eForms hub and the canvas which renders forms.

In case you are building dynamic web application which builds the html markup in the browser, then in case when the eForms renderer markup is added dynamically into the page by a Javascript code it is necessary to initialize eForms framework manually. This document describes, how to achieve it with an example.

Please note that functionality of manual initialization is supported from renderer version

The following example shows the structure of the eForms renderer required markup:

<div style="position:relative;">
            <input type="hidden" id="eFormsHubUrl" value="" />
            <canvas id="formHolder" DefaultFormUid="93856EB1-73C4-4033-B4C5-4C69AB556D9E" width="1000" height="600" DefaultFormVersion="null" FormStretch="Resize" WCFCompilerURL="" DefaulCulture="en-US" EnableDebugLog="true">

The following table describes eForms renderer canvas attributes:


Value example




Sets the default form that will be automatically loaded inside the canvas. This is an optional attribute.


•null (or not defined)

•page number

Sets the default version of the form instead of loading last one. If the attribute is not defined or „null“ than last form version will be loaded.



This culture will be used as default. If the form has more than one culture than this one will be used.



If this attribute is true then all debug logs from renderer and formsHub will be shown inside browser‘s console.


•Normal (or not defined)



Sets the canvas dimensions behavior. If „Normal“ or not defined – the form content will addapt to the canvas dimensions. If „Resize“ – the canvas will adapt to the form dimensions. „Responsive“ is actually in progress feature. The form content will be responsive.



Sets url of the RuntimeService.svc server service.


The example below uses onclick event of the button to generate the markup of the eForms renderer in the page (implemented by the hubStart function). HubStart function calls eForms.hubInit on the end in order to initialize eForms framework and establish eForms hub server connection. Once the initialization is completed, eForms factory calls your implementation of the OnFormRendererReady event handler.

//generates HTML DOM and starts FormsHub
function hubStart() {
    //generate div container
    const divContainer = document.createElement('div');

   //generate canvas
   const canvas = document.createElement('canvas');
   id = 'formHolder';

   //add attributes
   let att = document.createAttribute('FormStretch');
   att.value = 'Resize';

   att = document.createAttribute('WCFCompilerURL');
   att.value = '';

   //append canvas inside container

   //init hub

//alert me when form is ready
const alertReady = function () {
    alert('Form loaded');

//when hub connection is done and form renderer is ready
OnFormRendererReady = function () {
    OpenFormTemplate('formHolder', '93856EB1-73C4-4033-B4C5-4C69AB556D9E', version, null, alertReady , null);

<button onclick="hubStart();">Init hub</button>

Basic eForms factory events:




When code-behind is being hit this function is called. Inside this function can be specified what will happen on client side when renderer is loading or waiting for server response. Loading dialogue can be shown for example.


This function is being hit when server-side work (event handling) is done. This function can hide loading dialogue for example.

OnRendererError(msg, code)

Inside this function can be handled server side exceptions. Show default error message instead of whole error or do some log stuff etc.


This function is being hit on hub connection done event. Inside this function can be decided what will happen or be loaded when client connection is established.


The function is called immediately after form culture has been changed. This function can be used for script localizations and logic that will happen after culture change.