@@ -82,8 +82,8 @@ component {
8282 return " function( value, el, params ) { return true; }" ;
8383 }
8484
85- public boolean function requiredIfOtherFieldInValues ( required string fieldName , any value = " " , required struct data , required string otherField , required string otherFieldValues ) validatorMessage = " cms:validation.conditional.required.default" {
8685
86+ public boolean function requiredIfOtherFieldInValues ( required string fieldName , any value = " " , required struct data , required string otherField , required string otherFieldValues ) validatorMessage = " cms:validation.conditional.required.default" {
8787 var otherValues = ListToArray ( arguments .otherFieldValues );
8888 if ( ( ! ArrayContains ( otherValues , arguments .data [ arguments .otherField ] ?: " " ) ) ) {
8989 return true ;
@@ -103,6 +103,37 @@ component {
103103 }
104104
105105
106+ public boolean function minIfOtherFieldValue ( required string fieldName , string value = " " ) validatorMessage = " cms:validation.min.default" {
107+ if ( ( arguments .data [ arguments .otherField ] ?: " " ) ! = arguments .otherFieldValue ) {
108+ return true ;
109+ }
110+
111+ if ( not Len ( Trim ( arguments .value ) ) ) {
112+ return true ;
113+ }
114+
115+ return Val ( Replace ( arguments .value , " ," , " " , " all" ) ) >= arguments .minValue ;
116+ }
117+ public string function minIfOtherFieldValue_js () {
118+ return " function( value, el, params ) { return true; }" ;
119+ }
120+
121+ public boolean function maxIfOtherFieldValue ( required string fieldName , string value = " " ) validatorMessage = " cms:validation.min.default" {
122+ if ( ( arguments .data [ arguments .otherField ] ?: " " ) ! = arguments .otherFieldValue ) {
123+ return true ;
124+ }
125+
126+ if ( not Len ( Trim ( arguments .value ) ) ) {
127+ return true ;
128+ }
129+
130+ return Val ( Replace ( arguments .value , " ," , " " , " all" ) ) <= arguments .maxValue ;
131+ }
132+ public string function maxIfOtherFieldValue_js () {
133+ return " function( value, el, params ) { return true; }" ;
134+ }
135+
136+
106137 public boolean function ukPhone ( required string fieldName , string value = " " ) validatorMessage = " validationExtras:validation.ukPhone.default" {
107138 if ( not Len ( Trim ( arguments .value ) ) ) {
108139 return true ;
0 commit comments