File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
runner/src/server/plugins/engine/page-controllers Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,26 @@ export class RepeatingFieldPageController extends PageController {
126
126
return parentSchema ;
127
127
}
128
128
129
+ async validateComponentFunctions ( request , viewModel ) {
130
+ let errors = await super . validateComponentFunctions ( request , viewModel ) ;
131
+ const maxRows = this . inputComponent . options ?. maxMultiInputFieldRows ;
132
+ if ( maxRows ) {
133
+ const { adapterCacheService} = request . services ( [ ] ) ;
134
+ const state = await adapterCacheService . getState ( request ) ;
135
+ const currentRows = this . getPartialState ( state ) || [ ] ;
136
+ if ( currentRows . length >= maxRows ) {
137
+ const rowText = maxRows === 1 ? "row" : "rows" ;
138
+ errors . push ( {
139
+ path : this . inputComponent . name ,
140
+ name : this . inputComponent . name ,
141
+ text : `You cannot add more than ${ maxRows } ${ rowText } ` ,
142
+ } ) ;
143
+ }
144
+ }
145
+
146
+ return errors ;
147
+ }
148
+
129
149
makeGetRouteHandler ( ) {
130
150
return async ( request : HapiRequest , h : HapiResponseToolkit ) => {
131
151
const { query} = request ;
You can’t perform that action at this time.
0 commit comments