Skip to content

Rendering questionnaire

hzhao392 edited this page Dec 30, 2020 · 1 revision

Quest can be rendered on your web application by calling the transform.render method from replace2.js file. The render function takes 3 parameters obj, divId and previousResults

obj is a Javascript object that has the fields of
url: URL of questionnaire markup
activate: boolean value of questionnaire markup logic and styles
store: method that stores the data after each question
retrieve: method that retrieves the data to fill the form again

divId is the html element Id where the questionnaire will be mouunted

data is the input data seen here https://github.com/episphere/quest/wiki/Input-data

Sample render statement:

       data = {"firstName":"Alaina","age":"55","SEX":["3"],"SEX2":["6"]};
       transform.render({
            url: url,
            activate: true,
            store: storeResponse,
            retrieve: getMyData
        }, 'root', data);
Clone this wiki locally