Skip to content

Commit 74c3fcb

Browse files
committed
fix(frontend): allow digits in question field names for validation
Previously, validation messages failed to appear for form fields containing digits in their names. The regex now correctly distinguishes numeric-only parts from mixed alphanumeric ones.
1 parent 812aeb9 commit 74c3fcb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

frontend/src/composables/question/formDataUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function getErrorKey(path: string[]): string {
4545
// Remove 'general' prefix
4646
.slice(path[0] === 'general' ? 1 : 0)
4747
// Backend validation uses 0-based index
48-
.map((part) => (part.match(/\d+/) ? String(Number(part) - 1) : part))
48+
.map((part) => (part.match(/^\d+$/) ? String(Number(part) - 1) : part))
4949
.join('.')
5050
)
5151
}

0 commit comments

Comments
 (0)