INTRO
The forms module provides AST transform of FORM document model into NITRO element model (second layer) which later will be transformed into HTML5 encoding (first layer).
FORM PROVIDER
The input FORM module expects forms to expose the following API.
Module:id() -> tuple().
Should return the default business object instance for this document form.
Module:new(Name :: string(), BusinessObject :: tuple(), Options :: list({ atom(), term() })) -> element().
Should return the document form model by a given business object.
The standard set of options, provided with form base library:
EDIT
{edit,true} — form for editing purposes.
CREATE
{create,true} — form for document creation purposes.
EDIT
{view,true} — form for document read only view mode.
SEARCH
{search,true} — form for document search purposes with disabled validators.
ROW
{row,true} — form for document row representation inside a table view.
Module:doc() -> binary() | list().
Retrieves the documentation string about this form module.
FORM API
sources(Object :: tuple()) -> list().
Returns the list of atoms that should be used as a value of sources field of NITRO elements used for input data binding.
type(Object :: record()) -> atom().
Returns BEAM preloaded atom used as an object type. Usually second element of a tuple.
kind(Options :: proplist()) -> atom().
Transforms boolean tuples in options to atoms.
pos(Object :: tuple(), #field{}) -> integer().
Returins position of field in tuple by reffering to KVS metainfo.
extract(Object :: tuple(), #field{}) -> term().
Extracts the value from business object by a given field.
evoke(Object :: tuple(), #field{}, Value :: term()) -> term().
Evoke the new value of business object by a given field.
dispatch(Object :: tuple(), Options :: proplist()) -> #element{}.
Renders the business object to NITRO elements by reffering to FORM registry.
new(#document{}, Object :: tuple(), Options :: proplist()) -> #element().
Renders FORM document to NITRO element.
Evoke the new value of business object by a given field.
The following functions that are normally called from new builder:
fields(#document{}, Object :: tuple(), Options :: proplists()) -> list(#element{}).
Renders the form fields to NITRO elements.
caption(#document{}, Object :: tuple(), Options :: proplists()) -> #panel{}.
Renders the form caption to NITRO panel.
buttons(#document{}, Object :: tuple(), Options :: proplists()) -> #panel{}.
Renders the form buttons to NITRO panel.
The following functions that are normally called from fields builder:
fieldType(#field{}, Acc :: list(#element{}), Object :: tuple(), Options :: proplists()) -> list(#element{}).
Renders the particular field of a from inside a fields loop.
fieldType(Type :: atom(), #field{}, Vector :: list(#element{}), Object :: tuple(), Options :: proplists()) -> list(#element{}).
Renders the particular vector field of a from inside a fields loop. Normally called from fieldType/4.
This module may refer to: MAN_MODULES