File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -1292,13 +1292,24 @@ if (typeof brutusin === "undefined") {
1292
1292
}
1293
1293
1294
1294
function getInitialValue ( id ) {
1295
- var ret ;
1296
- try {
1297
- eval ( "ret = initialValue" + id . substring ( 1 ) ) ;
1298
- } catch ( e ) {
1299
- ret = null ;
1295
+ var fields = id . substring ( 2 ) . split ( '.' ) ;
1296
+ var initialValueClone = initialValue ;
1297
+ for ( var i = 0 ; i < fields . length ; i ++ ) {
1298
+ var field = fields [ i ] ;
1299
+ if ( field != "" ) {
1300
+ if ( field . substring ( field . length - 1 ) === "]" ) {
1301
+ //Get the index from the array in the field
1302
+ var arrayIndex = parseInt ( field . substring ( field . lastIndexOf ( "[" ) + 1 , field . length - 1 ) ) ;
1303
+ //Substring off the square bracket from the field
1304
+ field = field . substring ( 0 , field . lastIndexOf ( "[" ) ) ;
1305
+ initialValueClone = initialValueClone [ field ] [ arrayIndex ] ;
1306
+ } else {
1307
+ initialValueClone = initialValueClone [ field ] ;
1308
+ }
1309
+ }
1300
1310
}
1301
- return ret ;
1311
+
1312
+ return initialValueClone ;
1302
1313
}
1303
1314
1304
1315
function getValue ( schema , input ) {
You can’t perform that action at this time.
0 commit comments