Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
en:create:checks [12.01.2015 21:29] – admin | en:create:checks [05.05.2015 13:02] – admin |
---|
With the PHP function [[:en:create:functions:getanswermissing|getAnswerMissing()]] and [[:en:create:functions:listfails|listFails()]] you are able to check which questions or items were not answered. By using [[:en:create:functions:text|text()]] you can then display customized error message text -- but only in addition to the predefined error message. | With the PHP function [[:en:create:functions:getanswermissing|getAnswerMissing()]] and [[:en:create:functions:listfails|listFails()]] you are able to check which questions or items were not answered. By using [[:en:create:functions:text|text()]] you can then display customized error message text -- but only in addition to the predefined error message. |
| |
===== Customized Response Checks ===== | ===== 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 filter and the [[:en:create:functions:repeatpage|repeatPage()]] function. |
**Tip:** Use the function ''[[:en:create:functions:markfail|markFail()]]'' to highlight inputs with incorrect responses. | **Tip:** Use the function ''[[:en:create:functions:markfail|markFail()]]'' to highlight inputs with incorrect responses. |
| |
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. | Display an error message by passing the ID of a text element to ''repeatPage()'' (see below). Alternatively, you may simply 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 ==== | ==== Example: All Items or None at All ==== |
// Error and go back if not all or none were answered | // Error and go back if not all or none were answered |
if ((count($answered) > 0) and (count($answered) < count($items))) { | if ((count($answered) > 0) and (count($answered) < count($items))) { |
text('error_AB01'); | repeatPage('error_AB01'); |
repeatPage(); | |
} | } |
</code> | </code> |
| |
| |
===== Probing ===== | ===== Probe ===== |
| |
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). |