Skip to content

Commit 0f6c4e6

Browse files
authored
Aftervalidator compare against null field
When using this validator to compare against another field in the model, if that field is null the validator will fail
1 parent 21e1f9f commit 0f6c4e6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

models/validators/AfterValidator.cfc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ component
5858
"get#arguments.validationData#"
5959
);
6060
}
61+
62+
// return true if no value to compare against
63+
if ( isNull( compareValue ) || isNullOrEmpty( compareValue ) ) {
64+
return true;
65+
}
6166

6267
/**
6368
* -1 if date1 is before than date2

0 commit comments

Comments
 (0)