2019.2

Table Of Contents
addCameraWidget(cameraID);
});
});
function getCameraIndex(){
return $("input.camera-dyn").length;
}
function addCameraWidget(cameraID, value) {
if(typeof value == 'undefined') {
value = '';
}
var html = '<label>Camera' +
'<div id="' + cameraID + '" role="cotg.PhotoWidget">' +
'<div class="panel" role="control-wrapper"
style="position:relative;">' +
'<img role="photo" src="">' +
'<input role="photo-data" class="camera-dyn" name="' + cameraID +
'" type="hidden" value="' + value + '">' +
'</div>' +
'<button class="small" role="take-button" type="button">Take
now</button>' +
'<button class="small" role="pick-button"
type="button">Library</button>' +
'<button class="small" role="clear-button"
type="button">Clear</button>' +
'</div></label>';
$('#cameras').append(html); // add the camera object to the DOM
$('#' + cameraID).cotgPhotoWidget(); // init COTG widget
}
Saving and restoring custom data and widgets
The Capture OnTheGo (COTG) app stores the values of the input fields to the local repository
of the app upon closing the Form. On reopening the Form the original input fields and their
values are restored. However, dynamically added widgets (see "Dynamically adding COTG
widgets" on page608) don't get restored. This needs to be handled in code. This topic explains
how to do that.
Page 611