1.8

Table Of Contents
Changing default settings for widgets
The Camera and Geolocation widgets have options that you can configure per element. You
can decide, for example, which buttons will be visible in a specific Camera element (see
"Element specific settings" on page432).
The default settings for these options are specified in the COTG plugin. It is possible to change
these defaults without modifying the plugin itself.
To do that, create a JavaScript file (see "Adding JavaScript files to the resources" on
page404) and specify the desired default settings in that file like this:
$.fn.widget.defaults.setting = value;
Make sure to include your JavaScript file in the Web context or in the Web section that contains
the COTG Form (see "Including a JavaScript file in a Web context" on page405).
All available settings are listed in the Capture OnTheGo API: "Capture OnTheGo API" on
page453.
Example
The following code sets the default timeout and accuracy for Geolocation objects. and the
default maximum height and width for Camera widgets.
$.fn.cotgGeolocation.defaults.timeout = 6000; // 6 secs
$.fn.cotgGeolocation.defaults.enableHighAccuracy = true;
$.fn.cotgPhotoWidget.defaults.width = 1024;
$.fn.cotgPhotoWidget.defaults.height = 768;
$.fn.cotgPhotoWidget.defaults.quality = 60;
Reacting to, or triggering, widget events
The new COTG plugin introduces custom events for COTG controls. You can trigger and/or
react to them as the user interacts with the Form.
l
Use jQuery’s .on() method to attach an event handler to an element (or set of elements).
Call this function on the $(document).ready event, which is triggered when the Form
is loaded in the app.
l
Use the .trigger() method to trigger an element's event.
The events of all COTG widgets are listed in the Capture OnTheGo API: "Capture OnTheGo
API" on page453.
Page 444