Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision |
en:create:functions:replace [28.11.2015 17:23] – Update DE admin | en:create:functions:replace [20.08.2018 08:05] (current) – admin |
---|
| |
| |
| ====== Notes ====== |
| |
| **Important:** ''replace()'' must be placed before or above the element containing the placeholder. If the placeholder ''%test%'' is used e.g. in the text module "instruction", then the command ''replace('%test%', ...)'' must be invoked in the questionnaire before/above the text element. ''replace()'' can either be on the same page above the text module or on a previous page in the questionnaire. |
| |
| **Note:** To allow the ''replace()'' function to access a response from the participant (third parameter '''response'''), the participant must click "Next", __before__ ''replace()'' is invoked. As with the function ''[[:en:create:functions:value]]'', ''replace(..., 'AB01', 'response')'' must not be on the same page as question AB01. |
| |
===== Examples ===== | ===== Examples ===== |
// Replace %response% with the response of the participant to the single selection question AB02 | // Replace %response% with the response of the participant to the single selection question AB02 |
replace('%response%', 'AB02', 'response'); | replace('%response%', 'AB02', 'response'); |
| |
| // Replace %number% by a new question number |
| replace('%number%', 'qn+', 'special'); |
| html('<div class="title">%number%. Please select the ...</div>'); |
</code> | </code> |