|
Using COTG ElementsCapture OnTheGo (COTG) elements are Web Form elements that are specially designed to be used in a Capture OnTheGo Form (see Capture OnTheGo). This topic explains how to add these elements to a Capture OnTheGo Form or and how to prepare them so that when the Form is submitted, they provide valid data that can be handled easily. For a description of all COTG elements, see COTG Elements. Adding COTG elements to a FormTo add a COTG element to a Form or Fieldset, click inside the Form or Fieldset, select Insert > COTG elements, and choose the respective element on the menu. Now you can change the element's settings:
When you add a COTG element to a template that you didn't start with a COTG template wizard, the Designer will automatically add the jQuery library and the JavaScript file cotg.js, so that the element works well. The Foundation JavaScript files and style sheets will not be added. You only get those automatically when you start creating a COTG template with a template wizard.
Element specific settingsAfter inserting them, certain COTG elements, such as the Camera element, some important settings have to be made. These will appear when you right-click the element and select it from the short-cut menu. AttributesThe attributes (which aren't the same as the settings mentioned above) of a COTG element can be seen on the Attributes pane, after selecting the element (see Selecting an element). All COTG elements have a As noted, the Use the Outline pane at the left to see which elements are present in the template and to select an element. Use the Attributes pane at the right to see the current element's ID, class and some other properties. Use the Styles pane next to the Attributes pane to see which styles are applied to the currently selected element. Click the Edges button on the toolbar to make borders of elements visible on the Design tab. The borders will not be visible on the Preview tab. How to make COTG elements requiredTo make a COTG element required, or to change the validation of a COTG Form, right-click the element and choose Validation settings. Set the Form's validation method to jQuery and set the requirements and a message per field. For an explanation see Changing a Form's validation method. Grouping data using arraysA Job Data File is an XML file created by a Workflow process on submitting a Web Form or COTG Form. Grouping data in a Job Data File greatly simplifies both the Data Mapping workflow and looping over data in Designer scripts. A simple method to create arrays in that data file is to use two pairs of square brackets in the name of the form inputs. Put the name of the array between the first pair of square brackets. Between the second pair of square brackets, define the key to which the value belongs. Consider the following HTML form inputs:
The above HTML results in the following XML:
To enable submitting arrays, you need to check this option in the HTTP Server user preferences in (PlanetPress Connect) Watch.
In case multiple fields with the same name are encountered the previous value is overwritten. This way only a single occurrence of that field name will we available in the data containing the value of the last encountered occurrence of that field. This behaviour is also seen in the PHP language. For a detailed explanation of how to use this feature, see: Using The PHP Array Option. Getting the status of unchecked checkboxes and radio buttonsUnchecked checkboxes and radio buttons are not submitted (as per standard HTML behavior), so how to get the state of those checkboxes and radio buttons? A common approach to get the state of unchecked checkboxes and radio buttons is to add a add a hidden field to the Form with the same name as the checkbox or radio button, for example: <input type="hidden" name="status_1" value="0" /> <input type="checkbox" id="status_1" name="status_1" value="1" /> When multiple fields with the same name are encountered, the previous value is overwritten. This way the values for unchecked checkboxes and radio buttons can be processed easily. |
|