@@ -89,8 +89,9 @@ component accessors="true" serialize="false" implements="IValidationManager" sin
89
89
* @constraints.hint An optional shared constraints name or an actual structure of constraints to validate on.
90
90
* @locale.hint An optional locale to use for i18n messages
91
91
* @excludeFields.hint An optional list of fields to exclude from the validation.
92
+ * @IncludeFields.hint An optional list of fields to include in the validation.
92
93
*/
93
- IValidationResult function validate (required any target , string fields = " *" , any constraints = " " , string locale = " " , string excludeFields = " " ){
94
+ IValidationResult function validate ( required any target , string fields = " *" , any constraints = " " , string locale = " " , string excludeFields = " " , string includeFields = " " ){
94
95
var targetName = " " ;
95
96
96
97
// Do we have a real object or a structure?
@@ -119,15 +120,23 @@ component accessors="true" serialize="false" implements="IValidationManager" sin
119
120
// iterate over constraints defined
120
121
var this Field = " " ;
121
122
for ( this Field in allConstraints ){
123
+
124
+ var validateField = true ;
125
+ if ( len ( arguments .includeFields ) AND NOT listFindNoCase ( arguments .includeFields , this Field ) ){
126
+ validateField = false ;
127
+ }
122
128
// exclusions passed and field is in the excluded list just continue
123
129
if ( len ( arguments .excludeFields ) and listFindNoCase ( arguments .excludeFields , this Field ) ){
124
- continue ;
130
+ validateField = false ;
125
131
}
126
- // verify we can validate the field described in the constraint
127
- if ( arguments .fields == " *" || listFindNoCase (arguments .fields , this Field ) ) {
128
- // process the validation rules on the target field using the constraint validation data
129
- processRules (results = results , rules = allConstraints [this Field ], target = arguments .target , field = this Field , locale = arguments .locale );
132
+ if ( validateField ){
133
+ // verify we can validate the field described in the constraint
134
+ if ( arguments .fields == " *" || listFindNoCase ( arguments .fields , this Field ) ) {
135
+ // process the validation rules on the target field using the constraint validation data
136
+ processRules ( results = results , rules = allConstraints [ this Field ], target = arguments .target , field = this Field , locale = arguments .locale );
137
+ }
130
138
}
139
+
131
140
}
132
141
133
142
return results ;
@@ -141,7 +150,7 @@ component accessors="true" serialize="false" implements="IValidationManager" sin
141
150
for ( var key in arguments .rules ){
142
151
// if message validators, just ignore
143
152
if ( reFindNoCase ( " Message$" , key ) ){ continue ; }
144
-
153
+
145
154
// had to use nasty evaluate until adobe cf get's their act together on invoke.
146
155
getValidator ( validatorType = key , validationData = arguments .rules [ key ] )
147
156
.validate (
0 commit comments