formz/formz_use

Types

Form

opaque
pub opaque type Form(format, output)
pub type FormItem(format) {
  Element(field.Field, widget: widget.Widget(format))
  Set(subform.SubForm, items: List(FormItem(format)))
}

Constructors

  • Element(field.Field, widget: widget.Widget(format))
  • Set(subform.SubForm, items: List(FormItem(format)))

Functions

pub fn create_form(thing: a) -> Form(b, a)
pub fn data(
  form: Form(a, b),
  input_data: List(#(String, String)),
) -> Form(a, b)
pub fn get(
  form: Form(a, b),
  name: String,
) -> Result(FormItem(a), Nil)
pub fn items(form: Form(a, b)) -> List(FormItem(a))
pub fn optional(
  field: Field,
  is definition: Definition(a, b, c),
  rest fun: fn(c) -> Form(a, d),
) -> Form(a, d)
pub fn parse(form: Form(a, b)) -> Result(b, Form(a, b))
pub fn parse_then_try(
  form: Form(a, b),
  apply fun: fn(Form(a, b), b) -> Result(c, Form(a, b)),
) -> Result(c, Form(a, b))
pub fn require(
  field: Field,
  is definition: Definition(a, b, c),
  rest fun: fn(b) -> Form(a, d),
) -> Form(a, d)
pub fn update(
  form: Form(a, b),
  name: String,
  fun: fn(FormItem(a)) -> FormItem(a),
) -> Form(a, b)
pub fn update_field(
  form: Form(a, b),
  name: String,
  fun: fn(Field) -> Field,
) -> Form(a, b)
pub fn update_subform(
  form: Form(a, b),
  name: String,
  fun: fn(SubForm) -> SubForm,
) -> Form(a, b)
pub fn with_form(
  details: SubForm,
  sub: Form(a, b),
  fun: fn(b) -> Form(a, c),
) -> Form(a, c)
Search Document