@@ -108,8 +108,8 @@ component {
108108 return " function( value, el, params ) { return true; }" ;
109109 }
110110
111- public boolean function requiredIfOtherFieldInValues ( required string fieldName , any value = " " , required struct data , required string otherField , required string otherFieldValues ) validatorMessage = " cms:validation.conditional.required.default" {
112111
112+ public boolean function requiredIfOtherFieldInValues ( required string fieldName , any value = " " , required struct data , required string otherField , required string otherFieldValues ) validatorMessage = " cms:validation.conditional.required.default" {
113113 var otherValues = ListToArray ( arguments .otherFieldValues );
114114 if ( ( ! ArrayContains ( otherValues , arguments .data [ arguments .otherField ] ?: " " ) ) ) {
115115 return true ;
@@ -129,6 +129,37 @@ component {
129129 }
130130
131131
132+ public boolean function minIfOtherFieldValue ( required string fieldName , string value = " " ) validatorMessage = " cms:validation.min.default" {
133+ if ( ( arguments .data [ arguments .otherField ] ?: " " ) ! = arguments .otherFieldValue ) {
134+ return true ;
135+ }
136+
137+ if ( not Len ( Trim ( arguments .value ) ) ) {
138+ return true ;
139+ }
140+
141+ return Val ( Replace ( arguments .value , " ," , " " , " all" ) ) >= arguments .minValue ;
142+ }
143+ public string function minIfOtherFieldValue_js () {
144+ return " function( value, el, params ) { return true; }" ;
145+ }
146+
147+ public boolean function maxIfOtherFieldValue ( required string fieldName , string value = " " ) validatorMessage = " cms:validation.min.default" {
148+ if ( ( arguments .data [ arguments .otherField ] ?: " " ) ! = arguments .otherFieldValue ) {
149+ return true ;
150+ }
151+
152+ if ( not Len ( Trim ( arguments .value ) ) ) {
153+ return true ;
154+ }
155+
156+ return Val ( Replace ( arguments .value , " ," , " " , " all" ) ) <= arguments .maxValue ;
157+ }
158+ public string function maxIfOtherFieldValue_js () {
159+ return " function( value, el, params ) { return true; }" ;
160+ }
161+
162+
132163 public boolean function ukPhone ( required string fieldName , string value = " " ) validatorMessage = " validationExtras:validation.ukPhone.default" {
133164 if ( not Len ( Trim ( arguments .value ) ) ) {
134165 return true ;
0 commit comments