Function: pickActiveFields()
function pickActiveFields(
data: FormDataRecord,
steps: {
description: string | null;
fields: {
additionalInfo?: {
body?: string;
title?: string;
};
adoptionStatement?: string;
allowedFonts?: string[];
asset?: {
alt?: string;
fileId?: string;
filename?: string;
mimeType?: string;
url?: string;
};
dataSource?: string;
defaultValue?: | string
| {
from: string;
to: string | null;
};
description?: string;
fields?: {
additionalInfo?: {
body?: string;
title?: string;
};
adoptionStatement?: string;
allowedFonts?: string[];
asset?: {
alt?: string;
fileId?: string;
filename?: string;
mimeType?: string;
url?: string;
};
dataSource?: string;
defaultValue?: | string
| {
from: string;
to: string | null;
};
description?: string;
format?: string;
label: string;
maxDate?: string;
maxFiles?: number;
maxLength?: number;
minDate?: string;
name: string;
options?: (
| string
| {
description?: ...;
value: ...;
})[];
placeholder?: string;
prefillFrom?: string;
required: boolean;
showRange?: boolean;
showTime?: boolean;
signatureMode?: "typed" | "drawn";
timezone?: string;
type: | "number"
| "date"
| "file"
| "email"
| "url"
| "select"
| "text"
| "checkbox"
| "textarea"
| "phone"
| "radio-group"
| "multiselect"
| "field-array"
| "image"
| "file-download"
| "section-header"
| "section-unset"
| "signature"
| "signature-adopted";
}[];
format?: string;
label: string;
maxDate?: string;
maxFiles?: number;
maxLength?: number;
maxRows?: number;
minDate?: string;
minRows?: number;
name: string;
options?: (
| string
| {
description?: string;
value: string;
})[];
placeholder?: string;
prefillFrom?: string;
required: boolean;
showRange?: boolean;
showTime?: boolean;
signatureMode?: "typed" | "drawn";
timezone?: string;
type: | "number"
| "date"
| "file"
| "email"
| "url"
| "select"
| "text"
| "checkbox"
| "textarea"
| "phone"
| "radio-group"
| "multiselect"
| "field-array"
| "image"
| "file-download"
| "section-header"
| "section-unset"
| "signature"
| "signature-adopted";
}[];
formSchemaVersionId: string;
id: string;
key: string;
label: string | null;
}[],
visitedStepKeys: string[]
): FormDataRecord;Defined in: shared/forms/build-submission-schema.ts:28
Strip orphaned fields (fields belonging to non-visited steps) out of the data blob before validation. Useful when a user backtracks across a branching decision and we want to discard answers from the abandoned branch.
Parameters
| Parameter | Type |
|---|---|
data | FormDataRecord |
steps | { description: string | null; fields: { additionalInfo?: { body?: string; title?: string; }; adoptionStatement?: string; allowedFonts?: string[]; asset?: { alt?: string; fileId?: string; filename?: string; mimeType?: string; url?: string; }; dataSource?: string; defaultValue?: | string | { from: string; to: string | null; }; description?: string; fields?: { additionalInfo?: { body?: string; title?: string; }; adoptionStatement?: string; allowedFonts?: string[]; asset?: { alt?: string; fileId?: string; filename?: string; mimeType?: string; url?: string; }; dataSource?: string; defaultValue?: | string | { from: string; to: string | null; }; description?: string; format?: string; label: string; maxDate?: string; maxFiles?: number; maxLength?: number; minDate?: string; name: string; options?: ( | string | { description?: ...; value: ...; })[]; placeholder?: string; prefillFrom?: string; required: boolean; showRange?: boolean; showTime?: boolean; signatureMode?: "typed" | "drawn"; timezone?: string; type: | "number" | "date" | "file" | "email" | "url" | "select" | "text" | "checkbox" | "textarea" | "phone" | "radio-group" | "multiselect" | "field-array" | "image" | "file-download" | "section-header" | "section-unset" | "signature" | "signature-adopted"; }[]; format?: string; label: string; maxDate?: string; maxFiles?: number; maxLength?: number; maxRows?: number; minDate?: string; minRows?: number; name: string; options?: ( | string | { description?: string; value: string; })[]; placeholder?: string; prefillFrom?: string; required: boolean; showRange?: boolean; showTime?: boolean; signatureMode?: "typed" | "drawn"; timezone?: string; type: | "number" | "date" | "file" | "email" | "url" | "select" | "text" | "checkbox" | "textarea" | "phone" | "radio-group" | "multiselect" | "field-array" | "image" | "file-download" | "section-header" | "section-unset" | "signature" | "signature-adopted"; }[]; formSchemaVersionId: string; id: string; key: string; label: string | null; }[] |
visitedStepKeys | string[] |