formz/formz_builder

Types

Form

opaque
pub opaque type Form(format, output, decoder, has_decoder)
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)))
pub type HasDecoder
pub type NoDecoder

Functions

pub fn add_form(
  previous_form: Form(a, fn(b) -> c, d, e),
  details: SubForm,
  sub: Form(a, b, f, HasDecoder),
) -> Form(a, c, d, e)
pub fn data(
  form: Form(a, b, c, d),
  input_data: List(#(String, String)),
) -> Form(a, b, c, d)
pub fn decodes(
  form: Form(a, b, c, d),
  decoder: c,
) -> Form(a, b, c, HasDecoder)
pub fn get(
  form: Form(a, b, c, d),
  name: String,
) -> Result(FormItem(a), Nil)
pub fn items(form: Form(a, b, c, d)) -> List(FormItem(a))
pub fn new() -> Form(a, b, b, NoDecoder)
pub fn optional(
  previous_form: Form(a, fn(b) -> c, d, e),
  field: Field,
  definition: Definition(a, f, b),
) -> Form(a, c, d, e)
pub fn parse(
  form: Form(a, b, c, HasDecoder),
) -> Result(b, Form(a, b, c, HasDecoder))
pub fn parse_then_try(
  form: Form(a, b, c, HasDecoder),
  apply fun: fn(Form(a, b, c, HasDecoder), b) ->
    Result(d, Form(a, b, c, HasDecoder)),
) -> Result(d, Form(a, b, c, HasDecoder))
pub fn require(
  previous_form: Form(a, fn(b) -> c, d, e),
  field: Field,
  definition: Definition(a, b, f),
) -> Form(a, c, d, e)
pub fn update(
  form: Form(a, b, c, d),
  name: String,
  fun: fn(FormItem(a)) -> FormItem(a),
) -> Form(a, b, c, e)
pub fn update_field(
  form: Form(a, b, c, d),
  name: String,
  fun: fn(Field) -> Field,
) -> Form(a, b, c, d)
pub fn update_subform(
  form: Form(a, b, c, d),
  name: String,
  fun: fn(SubForm) -> SubForm,
) -> Form(a, b, c, d)
Search Document