CRUDUI

Home > @polyspec/crudui-form-binding > bindForm

bindForm() function

Validate a server-rendered form in the browser with the specification the server validates it with: a changed node when its control loses focus and on every later change, and the whole form on submit, where an invalid form is not submitted. The hidden attribute of every node follows its design.show against the data, and the choices of every field with a group source follow the rows of its group, when the form binds and after every change.

Signature:

export declare function bindForm(form: HTMLFormElement, spec: Record<string, unknown>, options?: FormBindingOptions): FormBinding;

Parameters

Parameter

Type

Description

form

HTMLFormElement

The parsed form element that holds one complete form.

spec

Record<string, unknown>

The specification the server validates the form with, its composition resolved.

options

FormBindingOptions

(Optional) Key prefix, texts, and the language and identifier prefix of the rendered form.

Returns:

FormBinding

Exceptions

TypeError for a value outside the contract, in the documented order.