2020.2

Table Of Contents
Using the COTG plugin: cotg-2.0.0.js
A Capture OnTheGo (COTG) Form may contain special COTG input elements, like a
Signature, Geolocation, or Camera element. These elements do not function without the COTG
JavaScript library. It is this library that links the controls with hardware features on the mobile
device.
As of Connect 1.8, cotg-2.0.0.js replaces the cotg-1.x.js versions of the library. The new COTG
plugin introduces options and custom events for COTG widgets. This greatly simplifies event-
based programming in Capture OnTheGo Forms. For example: your code can automatically set
a date for a Date field and retrieve the Geolocation as soon as a form has been signed.
All available options and events are listed in the Capture OnTheGo API: "Capture OnTheGo
API" on page600.
This topic explains in detail how to add the COTG plugin, how to change the defaults for COTG
widgets and how to use events.
How to add COTG elements to a Form dynamically is explained in another topic: "Dynamically
adding COTG widgets" on page589.
It is assumed that you have a basic understanding of HTML forms, CSS, JavaScript, and
jQuery. Examples on this page use jQuery.
About jQuery
This version of the COTG library is entirely based on jQuery. jQuery is a JavaScript library that
makes it very easy to select elements in a web page using HTML and CSS selectors, and to
manipulate those elements. You will need to use jQuery to dynamically add widgets to a COTG
Form. If you are new to it, spend a few minutes on learning it - it's that easy. For more
information, see: https://jquery.com/. and http://learn.jquery.com/.
Adding the plugin
When you create a template with a COTG Template Wizard (see "Capture OnTheGo template
wizards" on page560), the Designer automatically adds the jQuery library and the COTG
library: cotg-2.0.0.js.
This also happens when you add a Capture OnTheGo (COTG) element to a template that you
didn't start with a COTG template wizard.
Page 587