Skip to content

Commit 8af3fa1

Browse files
Merge branch 'feature-VALIDATION-7_requiredifotherfieldsempty' into release-1.3.0
2 parents 8588b3f + d58217f commit 8af3fa1

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

services/validation/ValidationExtrasValidators.cfc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,16 @@ component {
5151
, required struct data
5252
, required string otherFields
5353
, any value = ""
54-
) validatorMessage="cms:validation.conditional.required.default" {
55-
for ( var otherField in ListToArray( otherFields ) ) {
56-
if ( len( arguments.data[ otherField ] ?: "" ) ) {
57-
return true;
58-
}
59-
}
60-
return arguments.data.keyExists( fieldName ) && !IsEmpty( value );
61-
}
62-
63-
public string function requiredIfOtherFieldsEmpty_js() validatorMessage="cms:validation.conditional.required.default" {
54+
) validatorMessage="cms:validation.conditional.required.default" {
55+
for ( var otherField in ListToArray( otherFields ) ) {
56+
if ( len( arguments.data[ otherField ] ?: "" ) ) {
57+
return true;
58+
}
59+
}
60+
return arguments.data.keyExists( fieldName ) && !IsEmpty( value );
61+
}
62+
63+
public string function requiredIfOtherFieldsEmpty_js() validatorMessage="cms:validation.conditional.required.default" {
6464
return "function( value, el, params ){
6565
var otherFields = params[0].split(',');
6666
for ( var i=0; i<otherFields.length; i++ ) {
@@ -71,7 +71,7 @@ component {
7171
}
7272
return ( value.length > 0 );
7373
}";
74-
}
74+
}
7575

7676
public boolean function requiredIfOtherFieldNotEmpty( required string fieldName, any value="", required struct data, required string otherField ) validatorMessage="cms:validation.conditional.required.default" {
7777
if ( !len( arguments.data[ arguments.otherField ] ?: "" ) ) {

0 commit comments

Comments
 (0)