Page MenuHomeSealhub

hidden-input.ts
No OneTemporary

hidden-input.ts

import { Context } from "koa";
import { FlatTemplatable, tempstream } from "tempstream";
import { FormField } from "../fields/field";
import { FormDataValue } from "../form";
import { FormFieldControl } from "./form-field-control";
export class HiddenInput extends FormFieldControl {
constructor(public field: FormField, public value: FlatTemplatable) {
super([field]);
}
async render(
ctx: Context,
data: Record<string, FormDataValue>
): Promise<FlatTemplatable> {
const { raw } = await this.field.getValue(ctx, data);
return tempstream`<input type="hidden" name="${
this.field.name
}" value="${(raw || "").toString()}">`;
}
}

File Metadata

Mime Type
text/x-java
Expires
Thu, Jan 23, 19:19 (14 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
601498
Default Alt Text
hidden-input.ts (650 B)

Event Timeline