string getTextElement(string textID, [string output format])
Returns the HTML code for the text element with the ID textID as a string.
Note: If the text element is output in the questionnaire with a title and/or formatting, this is also included in the HTML code. However, the potential alignment (left/centred/right/justified) and the spacing below the text element are not included.
In the following example, one of 2 text elements (“desc1” or “desc2”) is integrated into a third placeholder (“description”) via placeholder. The third text element therefore must contain the placeholder %desc%
.
if (value('AB01_01') == 1) { $desc = getTextElement('desc1'); } else { $desc = getTextElement('desc2'); } replace('%desc%', $desc); text('description');
In the following example, each “a” and “A” is replaced with an underscore and the text element subsequently displayed.
$content = getTextElement('priming'); $out = str_replace(array('a','A'), '_', $content); html($out);