Modify Individual Survey Fields with Action Tags

redcap tip of the monthEver wish you could make a certain field read-only? Well, action tags will allow you to do that and more.

Action tags are a relatively new addition to REDCap and can be applied to any variable. Each action tag has a corresponding action that is performed when displayed on data entry forms and surveypages. For example, the action tag @READONLY will make the field read-only so that its value cannot be changed. Action tags can also automatically capture a date or time  or even pre-populate the field with a default value.

You can apply multiple action tags to the same variable. For instance, you can make a field automatically capture today’s date and make that same field read-only so that your survey participants can’t change that value.

To add an action tag, follow these steps:

  • In the online designer, navigate to the variable you want to add the action tag to.
  • Locate the red “Learn about Action Tags” link next to the field annotation box.
  • In the next dialog box, find the action tag you want to apply to that variable. Click Add.
  • Scroll to the bottom of the action tag dialog box and click Close. Then click Save in the “Edit Field” dialog box.

R-1_ActionTags_August_GIF

To delete an action tag from a variable, simply highlight the action tag in field annotation field and delete it with backspace or the delete button.

New action tags are being added to REDCap all the time so make sure to check for new options frequently.

Action tags available in version 6.15.14 and above.

@DEFAULT
Sets a field’s initial value. This allows a field to have a specified default value when viewing the field on a survey or data entry form that has not yet had any data saved for it (i.e., when the form status icon is gray or when a survey page has not had any data entered yet). The format must follow the pattern @DEFAULT=”????”, in which the desired default value should be inside single or double quotes. For checkbox fields, simply separate multiple checkbox values with commas – e.g., @DEFAULT=’1,3,6′. For text fields, you may even perform Piping inside the default value to pipe data from another field in the project – e.g., @DEFAULT=’Name: [first_name] [last_name], DOB: [dob]’. NOTE: The default value does *not* get applied during any data imports (via API or Data Import Tool) but only operates when viewing survey pages and data entry forms. NOTE: If being used on a date or datetime field, the date value inside the quotes must be in Y-M-D format – e.g., @DEFAULT=’2007-12-25′ – regardless of the field’s set date format.

@HIDDEN
Hides the field on the survey page, the data entry form, and in the REDCap mobile app. Field will stay hidden even if branching logic attempts to make it visible.

@HIDDEN-FORM
Hides the field only on the data entry form (i.e., not on the survey page). Field will stay hidden even if branching logic attempts to make it visible.

@HIDDEN-SURVEY
Hides the field only on the survey page (i.e., not on the data entry form). Field will stay hidden even if branching logic attempts to make it visible.

@HIDDEN-APP
Hides the field only on the form ONLY on the REDCap Mobile App. Field will stay hidden even if branching logic attempts to make it visible.

@READONLY
Makes the field read-only (i.e., disabled) on the survey page, the data entry form, and in the REDCap mobile app so that its value cannot be changed.

@READONLY-FORM
Makes the field read-only (i.e., disabled) only on the data entry form (i.e., not on the survey page or mobile app) so that its value cannot be changed.

@READONLY-SURVEY
Makes the field read-only (i.e., disabled) only on the survey page (i.e., not on the data entry form or mobile app) so that its value cannot be changed.

@READONLY-APP
Makes the field read-only (i.e., disabled) on the form ONLY on the REDCap Mobile App so that its value cannot be changed.

@USERNAME
Sets a field’s value to the username of the current REDCap user. If this is used on a survey, the value will be ‘[survey respondent]’. Once the value is captured, it will not be changed when visiting the page at a later time.

@APPUSERNAME-APP
In the REDCap Mobile App, it sets a field’s value to the app username of the current mobile app user – i.e., their username in the mobile app, which is not necessarily the same as their REDCap server username that can be captured using @USERNAME. NOTE: For use only in the REDCap Mobile App.

@LATITUDE
Allows a Text field field to capture the latitude of the user, in which the user will be prompted on the webpage to allow or deny this. Once the value is captured, it will not be changed when visiting the page at a later time. The field will be disabled and will not allow users to edit the value, but it will allow them to remove the value altogether. NOTE: While the GPS value will be very accurate when captured on a mobile device, it will not be nearly as accurate when using a browser on laptops and desktop computers.

@LONGITUDE
Allows a Text field to capture the longitude of the user, in which the user will be prompted on the webpage to allow or deny this. Once the value is captured, it will not be changed when visiting the page at a later time. The field will be disabled and will not allow users to edit the value, but it will allow them to remove the value altogether. NOTE: While the GPS value will be very accurate when captured on a mobile device, it will not be nearly as accurate when using a browser on laptops and desktop computers.

@NOW
Automatically provides the user’s current time as the value of a Text when the page is loaded. Once the value is captured, it will not be changed when visiting the page at a later time. If the field has validation, the value will conform to the date/time format of the field. The field will be disabled and will not allow users to edit the value. NOTE: The time will be the user’s local time, which is derived from their device/computer.

@TODAY
Automatically provides the user’s current date as the value of a Text when the page is loaded. Once the value is captured, it will not be changed when visiting the page at a later time. If the field has validation, the value will conform to the date/time format of the field. The field will be disabled and will not allow users to edit the value. NOTE: The date will be the user’s current date, which is derived from their device/computer.

@PASSWORDMASK
Masks the value of a Text field so that the true value is not visible on the webpage after it has been entered (like password fields on login pages)

@HIDEBUTTON
Hides the ‘Now’ or ‘Today’ button that is typically displayed to the right of date, time, and date/time fields.

 

This REDCap Tip of The Month content was developed in collaboration with the Institute of Translational Health Sciences, the University of Washington CTSA.