A REDCap External Module that allows injection of JavaScript on pages.
- REDCap 8.1.0 or newer (tested with REDCap 8.11.7).
- Clone this repo into
<redcap-root>/modules/redcap_js_injector_v<version-number>
, or - Obtain this module from the Consortium REDCap Repo via the Control Center.
- Go to Control Center > Technical / Developer Tools > External Modules and enable REDCap JavaScript Injector.
In a project, go to Applications > External Modules and click the Configure button for the REDCap JS Injector module.
In the configuration dialog, you can define JavaScript snippets for your project that are injected in different contexts. Each context is defined by a page type (Project Home Page, Record Status Dashboard, Add / Edit Records, Record Home Page, and Surveys, Data Entry Pages, Both, Surveys and Data Entry Pages, or All project pages. For data entry and survey pages, the context can be further limited by specifying one or more instruments.
The configuration options include a checkbox to enable/disable each of the JavaScript snippets. Make sure to enable the ones you want to be injected.
If more than one snippet is injected into the same page, the injection occurs in the order the snippets are defined in the configuration dialog.
Note: Due to a limitation in the EM configuration dialog, branching logic does not work for nested elements, and thus the instrument selection box cannot be hidden when not applicable (in case of Project Home Page, Record Status Dashboard, Add / Edit Records, and Record Home Page).
In the system configuration, admins can set this module's project configurations to be accessible only to super users.
This external module is basically just a modification of the REDCap CSS Injector module.
Instructions for testing the module can be found here.
Version | Description |
---|---|
1.1.2 | Add system setting for limiting project configuration access to super users only. |
1.1.1 | Fix the All project pages behavior that was broken in version 1.1.0. Disable branching logic. Add instructions for testing the module. |
1.1.0 | New feature: Inject JS on more project pages: Project Home Page, Record Home Page, Add / Edit Records, and Record Status Dashboard. |
1.0.0 | Initial release. |