This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:create:checks [15.01.2015 20:08] – [Probing] alexander.ritter | en: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, | + | If the predefined checks are insufficient, |
- | 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 |
- | + | ||
- | **Tip:** Further details about programming filters | + | |
- | + | ||
- | **Tip:** Use the function '' | + | |
- | + | ||
- | You will receive an error message when you display a text element using [[: | + | |
- | + | ||
- | ==== 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' | + | |
- | + | ||
- | <code php> | + | |
- | // Create a list of all items in the question | + | |
- | $items = getItems(' | + | |
- | // Determine items answered | + | |
- | $answered = getItems(' | + | |
- | // Error and go back if not all or none were answered | + | |
- | if ((count($answered) > 0) and (count($answered) < count($items))) { | + | |
- | text(' | + | |
- | repeatPage(); | + | |
- | } | + | |
- | </ | + | |