Module Incr_dom_widgets__.Form.State

Form state

type t

Represent the state of a form. A state does not have any type parameter so that it's easier to embed in other data structure (like Incr_dom.App_intf.Simple.Model.t).

A state is used in conjunction with the form it was created from. If you use a state with any other form an exception will be thrown.

include sig ... end
val compare : t ‑> t ‑> int
val create : ?⁠init:'a ‑> ('a_form ‑> t

Raises an exception if any initial value for variants is not a part of the options available in form.

val field_ids : t ‑> (_'idsform ‑> 'ids

Returns all ids defined in the given form.

val read_value : t ‑> ('a_form ‑> 'a option * t

Try to read the value contained in a form. Errors, if any, will be stored in the returned state.

val error : t ‑> _ Id.t ‑> Core_kernel.Error.t option

Return the error attached to a given id, if any.

val errors : t ‑> Core_kernel.Error.t list

Return all errors associated with the form state