2022.2

Table Of Contents
WhenthislibraryisincludedinaWebtemplateinsteadofaCOTGtemplate,itwon'taffectthetem-
plate,exceptwhentheusersubmitsaForm.Atthatmomentthepluginwillautomaticallyaddahidden
fieldforeveryuncheckedcheckboxontheForm.
Tip: Ifyouwanttotakealookatthecontents,youcanopenthepluginwithintheDesigner:
double-clickcotg-2.1.0.jsontheResourcespane.
Changingdefaultsettingsforwidgets
TheCameraandGeolocationwidgetshaveoptionsthatyoucanconfigureperelement.Youcan
decide,forexample,whichbuttonswillbevisibleinaspecificCameraelement(see"Elementspecific
settings"onpage537).
ThedefaultsettingsfortheseoptionsarespecifiedintheCOTGplugin.Itispossibletochangethese
defaultswithoutmodifyingthepluginitself.
Todothat,createaJavaScriptfile(see"AddingJavaScriptfilestotheResources"onpage513)and
specifythedesireddefaultsettingsinthatfilelikethis:
$.fn.widget.defaults.setting = value;
MakesuretoincludeyourJavaScriptfileintheWebcontextorintheWebsectionthatcontainsthe
COTGForm(see"IncludingaJavaScriptfileinaWebcontext"onpage515).
AllavailablesettingsarelistedintheCaptureOnTheGoAPI:"CaptureOnTheGoAPI"onpage557.
ThefollowingcodesetsthedefaulttimeoutandaccuracyforGeolocationobjects.andthedefaultmax-
imumheightandwidthforCamerawidgets.
$.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newCOTGpluginintroducescustomeventsforCOTGcontrols.Youcantriggerand/orreactto
themastheuserinteractswiththeForm.
l
UsejQuery’s.on()methodtoattachaneventhandlertoanelement(orsetofelements).Callthis
functiononthe$(document).readyevent,whichistriggeredwhentheFormisloadedinthe
app.
l
Usethe.trigger()methodtotriggeranelement'sevent.
TheeventsofallCOTGwidgetsarelistedintheCaptureOnTheGoAPI:"CaptureOnTheGoAPI"on
page557.
Page 547