Working …
This value you provided is not a number. Please try again.
This value you provided is not an integer. Please try again.
The value entered is not a valid Vanderbilt Medical Record Number (i.e. 4- to 9-digit number, excluding leading zeros). Please try again.
The value you provided must be within the suggested range
The value you provided is outside the suggested range
This value is admissible, but you may wish to double check it.
The value entered must be a time value in the following format HH:MM within the range 00:00-23:59 (e.g., 04:32 or 23:19).
This field must be a 5 or 9 digit U.S. ZIP Code (like 94043). Please re-enter it now.
This field must be a 10 digit U.S. phone number (like 415 555 1212). Please re-enter it now.
This field must be a valid email address (like joe@user.com). Please re-enter it now.
The value you provided could not be validated because it does not follow the expected format. Please try again.
Required format:
REDCap Logo
Plugins, Hooks, & External Modules
Developer methods for
Plugins, Hooks, & External Modules
Hook functions

REDCap Developer Tools:
Documentation for Plugins, Hooks, & External Modules

REDCap Version 14.9.1
REDCap::escapeHtml
(REDCap >= 5.11.0)
REDCap::escapeHtml — Escapes a string of text or HTML for outputting to a webpage
Description
string REDCap::escapeHtml ( string $string )
Escapes a string of text or HTML for outputting to a webpage. If the text being printed to the page is user input (i.e., was originally generated by a user), then it is highly recommended to escape it to prevent any possibility of Cross-site Scripting (XSS).
Parameters
string
Text string to be escaped.
Return Values
Returns the escaped string.
Examples
Example #1:
This example shows how to print a string of text on a webpage literally so that any HTML tags inside the text do not get interpreted. The output of the example below should be the following:

Here's my <b>bold</b> text. Attempt to perform cross-site scripting with <script>alert('XSS successful!')</script>
// Set the text value
$text = "Here's my <b>bold</b> text. Attempt to perform cross-site scripting
         with <script>alert('XSS successful!')</script>";

// Escape the text and output it to the webpage, which should display the string *exactly*
// as you see $text displayed above. If the string were not escaped, the word "bold" would
// appear in bold on the page, and it would cause a JavaScript pop-up saying "XSS successful!".
print REDCap::escapeHtml($text);
REDCap 14.9.1 - © 2024 Vanderbilt University