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
en:create:checks [14.01.2015 18:52] – [Customized Response Checks] alexander.ritteren:create:checks [23.11.2020 15:35] (current) – [Example: All Items or None at All] sophia.schauer
Line 66: Line 66:
 ===== Customized Response Check ===== ===== Customized Response Check =====
  
-If the predefined checks are insufficient, you can program a customized response check using a filter and the [[:en:create:functions:repeatpage|repeatPage()]] function.+If the predefined checks are insufficient, you can program a customized response check using a [[en:create:php-filters|PHP-filter]] and the [[:en:create:functions:repeatpage|repeatPage()]] function.
  
-The PHP code used to check the answer must be put on the page __after__ the question at the top. Therefore, if the question that needs to be checked is on page 2 then the PHP code that checks the question must be put at the top on page 3.+A detailed explanation and examples can be found in the [[:en:create:checks-php]] manual.
  
-**Tip:** Further details about programming filters can be found under [[:en:create:filters|Filter Questions and Filters]]. 
  
-**Tip:** Use the function ''[[:en:create:functions:markfail|markFail()]]'' to highlight inputs with incorrect responses. +===== Probe =====
- +
-You will receive an error message when you display a text element using [[:en:create:functions:text|text()]] when answers are missing/incorrect. When you set up the text element make sure the text is displayed in the style of a //warning// -- then it will have the same format as the standard error messages. +
- +
-==== Example: All Items or None at All ==== +
- +
-The following PHP code checks whether all items in a scale were answered -- or none at all. The question's ID (in example ''AB01'') must therefore be changed to reflect the actual question ID and the error message must be saved as a text element. If this text element's ID is not "error_AB01" then the ID must also be customized. +
- +
-<code php> +
-// Create a list of all items in the question +
-$items = getItems('AB01'); +
-// Determine items answered +
-$answered = getItems('AB01', '>', 0); +
-// Error and go back if not all or none were answered +
-if ((count($answered) > 0) and (count($answered) < count($items))) { +
-  text('error_AB01'); +
-  repeatPage(); +
-+
-</code> +
- +
- +
-===== Probing =====+
  
 It can make sense to probe when answers are missing for questions that are important for data analysis, or for questions that were simply missed out (e.g. items in long rows). It can make sense to probe when answers are missing for questions that are important for data analysis, or for questions that were simply missed out (e.g. items in long rows).
en/create/checks.1421257927.txt.gz · Last modified: 14.01.2015 18:52 by alexander.ritter
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki