@@ -21,7 +21,7 @@ component {
2121 return arguments .data .keyExists ( fieldName ) && ! IsEmpty ( value );
2222 }
2323 public string function requiredIfOtherFieldChecked_js () validatorMessage = " cms:validation.conditional.required.default" {
24- return " function( value, el, params ){ $otherField = $( '[name=' + params[0] + ']:checked' ); if ( !$otherField.length || !$otherField.is( ':checked' ) || ( params[1] != null && $otherField.val() != params[1] ) ) { return true; } return ( value.length > 0 ); }" ;
24+ return " function( value, el, params ){ $otherField = $( '[name=' + params[0] + ']:checked' ); if ( !$otherField.length || !$otherField.is( ':checked' ) || ( params[1] != null && $otherField.val() != params[1] ) ) { return true; } return ( value && value .length > 0 ); }" ;
2525 }
2626
2727
@@ -32,7 +32,7 @@ component {
3232 return arguments .data .keyExists ( fieldName ) && ! IsEmpty ( value );
3333 }
3434 public string function requiredIfOtherFieldNotChecked_js () validatorMessage = " cms:validation.conditional.required.default" {
35- return " function( value, el, params ){ $otherField = $( '[name=' + params[0] + ']' ); if ( !$otherField.length || $otherField.is( ':checked' ) ) { return true; } return ( value.length > 0 ); }" ;
35+ return " function( value, el, params ){ $otherField = $( '[name=' + params[0] + ']' ); if ( !$otherField.length || $otherField.is( ':checked' ) ) { return true; } return ( value && value .length > 0 ); }" ;
3636 }
3737
3838
@@ -43,7 +43,7 @@ component {
4343 return arguments .data .keyExists ( fieldName ) && ! IsEmpty ( value );
4444 }
4545 public string function requiredIfOtherFieldEmpty_js () validatorMessage = " cms:validation.conditional.required.default" {
46- return " function( value, el, params ){ $otherField = $( '[name=' + params[0] + ']' ); if ( !$otherField.length || $otherField.val().length ) { return true; } return ( value.length > 0 ); }" ;
46+ return " function( value, el, params ){ $otherField = $( '[name=' + params[0] + ']' ); if ( !$otherField.length || $otherField.val().length ) { return true; } return ( value && value .length > 0 ); }" ;
4747 }
4848
4949 public boolean function requiredIfOtherFieldsEmpty (
@@ -80,7 +80,7 @@ component {
8080 return arguments .data .keyExists ( fieldName ) && ! IsEmpty ( value );
8181 }
8282 public string function requiredIfOtherFieldNotEmpty_js () validatorMessage = " cms:validation.conditional.required.default" {
83- return " function( value, el, params ){ $otherField = $( '[name=' + params[0] + ']' ); if ( !$otherField.length || !$otherField.val().length ) { return true; } return ( value.length > 0 ); }" ;
83+ return " function( value, el, params ){ $otherField = $( '[name=' + params[0] + ']' ); if ( !$otherField.length || !$otherField.val().length ) { return true; } return ( value && value .length > 0 ); }" ;
8484 }
8585
8686
@@ -91,7 +91,7 @@ component {
9191 return arguments .data .keyExists ( fieldName ) && ! IsEmpty ( value );
9292 }
9393 public string function requiredIfOtherFieldValue_js () validatorMessage = " cms:validation.required.default" {
94- return " function( value, el, params ){ $otherField = $( '[name=' + params[0] + ']' ); if ( !$otherField.length ) { return true}; var otherValue = $otherField.prop('type')=='radio'?$( '[name=' + params[0] + ']:checked').val() : $otherField.val(); if ( otherValue != params[1] ) { return true; } return ( value.length > 0 ); }" ;
94+ return " function( value, el, params ){ $otherField = $( '[name=' + params[0] + ']' ); if ( !$otherField.length ) { return true}; var otherValue = $otherField.prop('type')=='radio'?$( '[name=' + params[0] + ']:checked').val() : $otherField.val(); if ( otherValue != params[1] ) { return true; } return ( value && value .length > 0 ); }" ;
9595 }
9696
9797 public boolean function requiredIfOtherFieldMatchSystemLookup ( required string fieldName , any value = " " , struct data = {}, required string otherField , required string category , required setting ) validatorMessage = " cms:validation.conditional.required.default" {
@@ -118,7 +118,7 @@ component {
118118 }
119119
120120 public string function requiredIfOtherFieldInValues_js () validatorMessage = " cms:validation.required.default" {
121- return " function( value, el, params ){ $otherField = $( '[name=' + params[0] + ']' ); if ( !$otherField.length ) { return true}; var otherValue = $otherField.prop('type')=='radio'?$( '[name=' + params[0] + ']:checked').val() : $otherField.val(); var otherValues = params[1].split(',');if ( !otherValues.includes( otherValue ) ) { return true; } return ( value.length > 0 ); }" ;
121+ return " function( value, el, params ){ $otherField = $( '[name=' + params[0] + ']' ); if ( !$otherField.length ) { return true}; var otherValue = $otherField.prop('type')=='radio'?$( '[name=' + params[0] + ']:checked').val() : $otherField.val(); var otherValues = params[1].split(',');if ( !otherValues.includes( otherValue ) ) { return true; } return ( value && value .length > 0 ); }" ;
122122 }
123123
124124 public boolean function simpleUrl ( required string fieldName , any value = " " ) validatorMessage = " validationExtras:validation.simpleUrl.default" {
0 commit comments