Inhaltsverzeichnis

replace()

With the help of placeholders, text in the questionnaire (e.g. question titles, items, stimuli) can be dynamically adapted. For detailed instructions, please see the chapter Placeholders. The function replace() sets up a placeholder for use in the questionnaire.

void replace(string placeholder, string content, [string type])

Examples

// Replace %brand% with "SoSci Survey" 
replace('%brand%', 'SoSci Survey');
 
// Replace %brand% with H20 (with 2 as a subscript with HTML code) 
replace('%brand%', 'H<sub>2</sub>O', 'html');
 
// Replace %response% with the response of the participant to the free text input AB01_01 
replace('%response%', 'AB01_01', 'response');
 
// Replace %response% with the response of the participant to the single selection question AB02 
replace('%response%', 'AB02', 'response');
 
// Replace %number% by a new question number
replace('%number%', 'qn+', 'special');
html('<div class="title">%number%. Please select the ...</div>');