Macaw.Builtin.AddForm (macaw v0.6.0)

Copy Markdown View Source

The built-in add form (spec/05 §6.8), "macaw.add_form": a form that adds a row to the visitor's overlay of a source (spec/13 §3), its fields from the source's schema, of kind :control, :pure (#453).

  • parameters: label (text, "Add a row"), the form's legend; submit (text, "Add"), its button's words; closed (text, "Rows can't be changed here."), what it says where the viewer may not change the rows or the mode takes no input;
  • declarations: the event "add", its value the row, each field to its value; its placement's action names the source, %{on: "add", add: "birds"};
  • fields (handed by the core, @settings["fields"]): the source's schema's, its identity fields first and then the rest in name order, each %{"name", "label", "type", "options", "required", "value", "errors"}; a category with declared values is a native <select>, any other field a text input, so every value the visitor types reaches the server and is judged there;
  • refusals at their fields: each field's refusals in words under it, linked by aria-describedby, the input aria-invalid, and a summary of them first, a role="alert" list linking each to its field; the row's own refusals in the summary alone. The text the visitor entered is kept;
  • markup: live, a <form phx-submit="mw-submit"> (Macaw.State.submit/4 reads it) with the event's payload in a hidden mw and each field mw-row[<field>]; with no socket and the host's links, the same fields in a <form method="post"> to the page's address (spec/13 §3.5); in :neutral and :print, and where the viewer may not change the rows, a paragraph of closed;
  • stylesheet: stylesheet/0, served at stylesheet_path/0, its content address.

Summary

Functions

The add form's one static stylesheet: its fields, their refusals and its summary, every color a theme custom property with the default theme's value as its fallback.

The stylesheet's path, its content address (Macaw.Component.Stylesheet.path/1).

Functions

stylesheet()

@spec stylesheet() :: String.t()

The add form's one static stylesheet: its fields, their refusals and its summary, every color a theme custom property with the default theme's value as its fallback.

stylesheet_path()

@spec stylesheet_path() :: String.t()

The stylesheet's path, its content address (Macaw.Component.Stylesheet.path/1).