CITI-SENSE widgets - Vitoria pilot


Widgets

In order to embed the widget into the the pilot portal, one needs to import the widget script:

<script src="http://citisense.u-hopper.com/widgets/perceptions/jquery.questionnaire.js"></script>

Ensure that on the CivicFlow portal, in web widget configuration the domain name of portal is enlisted, otherwise the browser will show an error "Cross-Origin Request Blocked" and will not display the requested questionnaire.

If together with the responses, one needs to submit custom information, such as for example the identifier of the user who responded the questionnaire, that information can be sent to the widget as a custom callback that is passed to the widget when a questionnaire is instantiated :
$("#q69").questionnaire({
    id: "69",
    hideAfterParticipation: false,
    custom: function() {
        // execute any relevant javascript in order to obtain custom value
        // for example read the user_email from some field with jQuery, e.g., $("#user_mail").val()
        return "custom_value";
    }
});

Application for mobile devices is written using Cordova/Phonegap.

The application can be also checked directly via browser.