@@ -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
@@ -54,7 +54,7 @@ component {
5454 return arguments .data .keyExists ( fieldName ) && ! IsEmpty ( value );
5555 }
5656 public string function requiredIfOtherFieldNotEmpty_js () validatorMessage = " cms:validation.conditional.required.default" {
57- return " function( value, el, params ){ $otherField = $( '[name=' + params[0] + ']' ); if ( !$otherField.length || !$otherField.val().length ) { return true; } return ( value.length > 0 ); }" ;
57+ return " function( value, el, params ){ $otherField = $( '[name=' + params[0] + ']' ); if ( !$otherField.length || !$otherField.val().length ) { return true; } return ( value && value .length > 0 ); }" ;
5858 }
5959
6060
@@ -65,7 +65,7 @@ component {
6565 return arguments .data .keyExists ( fieldName ) && ! IsEmpty ( value );
6666 }
6767 public string function requiredIfOtherFieldValue_js () validatorMessage = " cms:validation.required.default" {
68- 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 ); }" ;
68+ 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 ); }" ;
6969 }
7070
7171 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" {
@@ -75,7 +75,7 @@ component {
7575 if ( ! len ( trim ( lookupValue ) ) || ! len ( trim ( otherFieldValue ) ) ) {
7676 return true ;
7777 }
78-
78+
7979 return ! ( listFindNoCase ( lookupValue , otherFieldValue ) && ! len ( trim ( value ) ) );
8080 }
8181 public string function requiredIfOtherFieldMatchSystemLookup_js () {
@@ -92,7 +92,7 @@ component {
9292 }
9393
9494 public string function requiredIfOtherFieldInValues_js () validatorMessage = " cms:validation.required.default" {
95- 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 ); }" ;
95+ 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 ); }" ;
9696 }
9797
9898 public boolean function simpleUrl ( required string fieldName , any value = " " ) validatorMessage = " validationExtras:validation.simpleUrl.default" {
0 commit comments