Skip to content

Commit

Permalink
Check for data changes
Browse files Browse the repository at this point in the history
Check for data changes before triggering validation e.g. future date entered, then return to form after that date - only trigger validation if data on the form have changed.
  • Loading branch information
lsgs authored Mar 30, 2020
1 parent ce909cc commit 50840a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion DateValidationActionTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ protected function includeJS($taggedFields) {
default: var min = '', max = '';
}
//console.log('min='+min+' max='+max);
redcap_validate(ob, min, max, 'soft_typed', format, 1);
if (dataEntryFormValuesChanged) {
redcap_validate(ob, min, max, 'soft_typed', format, 1);
}
};

var taggedFields = JSON.parse('<?php echo json_encode($taggedFields); ?>');
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Action tags to validate date and datetime field entries:
- If more than one of these tags is applied to a field only the first will be used.
- You may still specify min/max literal values. The action tag check is applied after the range check.
- The action tag validation check is a soft check similar to existing range checks (i.e. a warning is displayed but the value is permitted).
- @FUTURE/@NOTPAST: when you enter a future date/time and then after that time return to the form, the validation check will be triggered only after data on the form has changed.

![Validate](./datevaltags-check.png)

Expand Down

0 comments on commit 50840a6

Please sign in to comment.