@UVREQUIRED
@UVREQUIRED is a REDCap action tag that makes a field required only while a condition is true, and can actually block the save instead of only warning like REDCap's native required flag.
REDCap's own required flag is unconditional and only warns.
@UVREQUIRED adds the two things it lacks: a condition and
a real block.
Syntax
@UVREQUIRED always required
@UVREQUIRED="[consent]='1'" required only while consented
@UVREQUIRED={"when":"[consent]='1'",
"message":"Phone needed for consented participants",
"blockSave":"hard"}
Behaviour
- A blank or whitespace-only field shows the notice while the requirement is in force. The requirement turns on and off live as the referenced fields change.
- Filling the field clears the notice. There is deliberately no green "OK", because
required mode never judges the value — pair it with
@UVALIDATEor@UVASSERTfor that. - Modes compose cleanly: on a blank field only
@UVREQUIREDfires; on a filled-but-wrong value only the value checks fire. Each keeps its own save-block state. - Several
@UVREQUIREDtags with differentwhenconditions branch. Two conditions true at once is a visible conflict that never blocks.
Field types
Text, Notes, dropdown, radio, yes/no, true/false and slider.
Not calc fields. The person entering data cannot fill a calc, so requiring one would trap them. The same reasoning covers read-only fields: a read-only field shows the notice but never blocks the save.
Audit
The server audit logs a blank-while-required save as type: required,
reason: required-blank. A blank carries nothing identifying, so this entry
is safe to keep in every privacy mode.