Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
en:create:inputs-custom [06.01.2015 20:49] – [Example: Use of JavaScript] alexander.ritteren:create:inputs-custom [17.03.2021 20:45] – [The Problem] sophia.schauer
Line 13: Line 13:
 HTML form elements (e.g. text input fields, checkboxes, drop-downs) can be programmed quickly: the essentials can be found on [[http://de.selfhtml.org/html/formulare/index.htm|SelfHTML]] (German only). Inserting HTML code into the questionnaire is quite simple with a text element (save the HTML code as a text element and drag into the questionnaire). HTML form elements (e.g. text input fields, checkboxes, drop-downs) can be programmed quickly: the essentials can be found on [[http://de.selfhtml.org/html/formulare/index.htm|SelfHTML]] (German only). Inserting HTML code into the questionnaire is quite simple with a text element (save the HTML code as a text element and drag into the questionnaire).
  
-The problem is that SoSci Survey does not initially recognize any form elements and the data they transmit, and as a result it does not save the responses. Therefore, it is advisable to inform SoSci Survey that certain POST variables should be read and saved in the data record. [[:en:create:questions:internal|Internal variables]] and ''[[:en:create:functions:prepare_input|prepare_input()]]'' are used to do so.+The problem is that SoSci Survey does not initially recognize any form elements and the data they transmit, and as a result it does not save the responses. Therefore, it is advisable to inform SoSci Survey that certain POST variables should be read and saved in the data record. [[:en:create:inputs-single|Freely placed input fields]] are used to do so.
  
  
Line 28: Line 28:
   * Enter a value in your form element and click on "Next". If you now click on the debug information (yellow corner at the top right of the page), there should be a note that the selected/entered value was stored.   * Enter a value in your form element and click on "Next". If you now click on the debug information (yellow corner at the top right of the page), there should be a note that the selected/entered value was stored.
  
-If you program more sophisticated input elements -- e.g. with JavaScript and/or Flash -- then, as a rule, you need to have hidden input fields to store the measured/collected values (see [[:de:create:break-counter|Note when Browser Window Changes]]).+If you program more sophisticated input elements -- e.g. with JavaScript and/or Flash -- then, as a rule, you need to have hidden input fields to store the measured/collected values (see [[:en:create:break-counter|Note when Browser Window Changes]]).
  
 In this instance, do __not__ use the PHP function ''prepare_input()''; drag the "internal variables" question type directly into the questionnaire page instead. This generates hidden input fields in the questionnaire (''%%<input type="hidden">%%'') automatically, and their values can be changed using JavaScript. The HTML ID of the input field corresponds to the item ID.  In this instance, do __not__ use the PHP function ''prepare_input()''; drag the "internal variables" question type directly into the questionnaire page instead. This generates hidden input fields in the questionnaire (''%%<input type="hidden">%%'') automatically, and their values can be changed using JavaScript. The HTML ID of the input field corresponds to the item ID. 
Line 38: Line 38:
 There are two major limitations when using custom form elements: There are two major limitations when using custom form elements:
  
-  - The meaning of the response code will not be saved in the data record. Whereas in a typical selection question, code 1 could be "student" and code 2 could be "employee", you have to keep an eye on this yourself when a custom form element is used. +  - The meaning of the answer code will not be saved in the data record. Whereas in a typical selection question, code 1 could be "student" and code 2 could be "employee", you have to keep an eye on this yourself when a custom form element is used. 
   - Making a response compulsory can be implemented with a [[:en:create:checks#individuelle_antwort-pruefung|Customized Response Check]]   - Making a response compulsory can be implemented with a [[:en:create:checks#individuelle_antwort-pruefung|Customized Response Check]]
   - If you want to give the participant the option of using the Back button, or if the page should be shown again if information is incomplete, you have to ensure that your form element shows a response given previously. In order to do so, you can read the value with ''[[:en:create:functions:value|value()]]'' and insert placeholders into the HTML code for the question.    - If you want to give the participant the option of using the Back button, or if the page should be shown again if information is incomplete, you have to ensure that your form element shows a response given previously. In order to do so, you can read the value with ''[[:en:create:functions:value|value()]]'' and insert placeholders into the HTML code for the question. 
en/create/inputs-custom.txt · Last modified: 17.03.2021 20:46 by sophia.schauer
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki