package incr_dom_widgets

  1. Overview
  2. Docs

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.

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 -> (_, 'ids) form -> '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

OCaml

Innovation. Community. Security.