ctsit / auto_populate_fields

This REDCap Module provides rich control of default values for data entry fields via a set of action tags. These action tags allow fields to be populated based on values from an ordered list of fields and static values. The fields can be read from the current event or the previous event in longitudinal projects.
Other
13 stars 12 forks source link

A user reports that the module renders the @READONLY-SURVEY action tag unusable #52

Closed ChemiKyle closed 3 years ago

ChemiKyle commented 3 years ago

https://community.projectredcap.org/questions/99382/auto-populate-fields-and-readonly-survey.html

Hi. We're using Auto Populate Fields and it is fantastic. We've encountered a situation where enabling the module seems to render @READONLY-SURVEY action tag unusable. It doesn't seem to matter where the in the project the action tags are called, simply enabling the module alone restricts fields from being grayed-out. We are using Auto Populate Fields - v2.6.0 on REDCap 10.3.7 Any ideas what's going on? Thanks!

michael-bentz commented 3 years ago

I can't reproduce the issue. I tested with the same environment using REDCap 10.3.7 and auto_populate_fields_v2.6.0. After enabling the module, fields marked with @READONLY-SURVEY are disabled on the survey. Maybe their expectation is that it should be disabled on form entry?

michael-bentz commented 3 years ago

Could not reproduce with sample project provided by Cameron Coffran.

Environment

REDCap 10.3.7
auto_populate_fields v2.6.0

Steps taken:

  1. Enable module in control center
  2. Create project from xml
  3. Enable module for project
  4. Opened public survey for Sample submission form

Results Fields marked with @READONLY-SURVEY are disabled on the survey.

Survey-readonly fields

michael-bentz commented 3 years ago

Hi Michael, I tested again and noticed that if I goto External Modules (on project level) -> Configure -> Enable Auto Populate Fields on survey pages: (check this option) and go back to my survey the readonly-survey fields are editable. If I uncheck this option readonly-survey is properly greyed out. So, it seems to be dependent on this checkbox.

The module does not preserve actions tags when Enable Auto Populate Fields on survey pages is enabled. Instead all action tags are overwritten with "@DEFAULT" regardless of what action tag(s) the field contains. The snippet below, specifically Line 52 is responsible for this. @ChemiKyle Is that the desired behavior of the module or should action tags be preserved? https://github.com/ctsit/auto_populate_fields/blob/71ba4f604ee3ae71a8c9d9a8d610bbdc4335027b/ExternalModule.php#L45-L57

michael-bentz commented 3 years ago

Resolved by PR #53