Skip to content

Commit

Permalink
Merge pull request #195 from formio/fio-8640-fixes--issue-where-rowIn…
Browse files Browse the repository at this point in the history
…dex-is-undefined-in-custom-validation

FIO-8640: Fixes an issue where rowIndex is undefined in custom validation
  • Loading branch information
brendanbond authored Nov 25, 2024
2 parents 770d1df + 2fc4bf6 commit 30ac705
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/process/validation/rules/validateCustom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ export const validateCustomSync: RuleFnSync = (context: ValidationContext) => {
return null;
}

const ctx = instance?.evalContext
? instance.evalContext()
: evalContext
? evalContext(context)
: context;
const evalContextValue = {
...(instance?.evalContext
? instance.evalContext()
: evalContext
? evalContext(context)
: context),
...ctx,
component,
data,
row,
rowIndex: index,
rowIndex: typeof index === 'number' ? index : ctx.rowIndex,
instance,
valid: true,
input: value,
Expand Down

0 comments on commit 30ac705

Please sign in to comment.