Page MenuHomeSealhub

make-hidden-inputs.ts
No OneTemporary

make-hidden-inputs.ts

import { Context } from "koa";
import { FlatTemplatable, tempstream } from "tempstream";
import { FormField } from "./forms/fields/field.js";
import { FormDataValue } from "./forms/form-types.js";
import { attribute } from "./sanitize.js";
export function makeHiddenInputs(
ctx: Context,
fields: Record<string, FormField>,
values: Record<string, FormDataValue>,
fields_to_skip: string[]
): FlatTemplatable {
return tempstream`${Object.entries(fields)
.filter(([key]) => !fields_to_skip.includes(key))
.map(
([key, field]) => tempstream/* HTML */ `<input
type="hidden"
name="${key}"
value="${field
.getValue(ctx, values)
.then((r) => attribute(JSON.stringify(r.raw) || ""))}"
/>`
)}`;
}

File Metadata

Mime Type
text/x-java
Expires
Fri, Jan 24, 15:16 (20 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
598889
Default Alt Text
make-hidden-inputs.ts (726 B)

Event Timeline