====== Observational Study Counter ======
SoSci Survey can also be used -- on a tablet, for example -- to assist observers in observational studies or coders in content analyses of video footage.
The following instructions explain how to program a questionnaire page on which several buttons are offered. If one of the buttons is clicked, the counter for the corresponding event is increased by 1.
{{:de:create:exp.observation-counter.png|Result}}
The questionnaire page contains five elements, which are explained below.
==== JavaScript-Code to Count ====
Ror the counting a little bit of JavaScript is needed. This code consists of two parts. One is a function ''count()'' which initializes or increments by one the value in the form field specified by an HTML ID. Second, a small JavaScript object ''ButtonCounter()'', which takes an HTML ID for a form field and a button, respectively. The object initializes the form field with the previously defined ''count()'' function and registers the JavaScript event handler, which responds to clicks.
Create a **New Text** in a section in the questionnaire (here in the example "JS"), set as *Display* "HTML Code" and insert the following JavaScript code. After saving, drag the text element under **Compose Questionnaire** as the first element on the questionnaire page.
==== CSS Code for Formatting the Buttons ====
In principle, the ''