Packages
form
5.3.4
11.4.15
11.4.14
8.3.0
8.0.0
7.10.0
7.8.0
7.7.0
7.6.2
7.6.1
7.6.0
7.4.2
7.4.1
7.4.0
7.1.0
6.11.1
6.10.7
6.10.6
6.10.5
6.10.4
6.10.2
6.10.1
6.4.0
5.12.1
5.12.0
5.8.7
5.8.6
5.8.5
5.8.4
5.8.3
5.8.2
5.8.1
5.8.0
5.7.0
5.5.0
5.3.4
5.3.3
5.3.2
5.3.1
5.3.0
5.1.10
5.1.9
5.1.8
5.1.7
5.1.6
5.1.5
5.1.4
5.1.3
5.1.2
5.1.1
4.12.3
4.12.2
4.12.1
4.12.0
4.11.15
4.11.14
4.11.13
4.11.12
4.11.11
4.11.10
4.11.9
4.11.8
4.11.7
4.11.6
4.11.5
4.11.4
4.11.3
4.11.2
4.11.1
4.11.0
4.10.5
4.10.4
4.10.3
4.10.2
4.10.1
4.10.0
4.7.0
4.6.0
ERP/1 X-FORM Business Cartulary
Current section
Files
Jump to
Current section
Files
man/form.htm
<html><head><meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="" />
<meta name="author" content="Maxim Sokhatsky" />
<title>FORM</title>
<link rel="stylesheet" href="https://n2o.dev/blank.css" />
<link rel="stylesheet" href="https://n2o.dev/zima.css" />
</head><body><nav>
<a href="https://n2o.dev">DEV</a>
<a href="https://form.n2o.dev">FORM</a>
<a href="#" style="background:#ededed;">API</a>
<div class="dropdown">
<a onclick="drop()" class="dropbtn">EN</a>
<div id="dropdown" class="dropdown-content">
<a href="https://n2o.dev/deps/form/man/ua/forms.htm">UA</a>
<a href="#">EN</a>
</div>
</div>
</nav><header>
<a href="../index.html"><img src="https://openmoji.org/data/color/svg/1F4C3.svg"/></a>
<h1>FORM</h1>
</header>
<main>
<article>
<section>
<h3>INTRO</h3>
<p>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).</p>
</section>
<section>
<h3>FORM PROVIDER</h3>
<p>The input FORM module expects forms to expose the following API.</p>
<h4>Module:id() -> tuple().</h4>
<p>Should return the default business object instance for this document form.</p>
<figure><code> id() -> #'Document'{}.</code></figure>
<h4>Module:new(Name :: string(),
BusinessObject :: tuple(),
Options :: list({ atom(), term() })) -> element().</h4>
<p>Should return the document form model by a given business object.</p>
<p>The standard set of options, provided with form base library:</p>
<div>
<h4>EDIT</h4>
<p><b>{edit,true}</b> — form for editing purposes.</p>
<h4>CREATE</h4>
<p><b>{create,true}</b> — form for document creation purposes.</p>
<h4>EDIT</h4>
<p><b>{view,true}</b> — form for document read only view mode.</p>
<h4>SEARCH</h4>
<p><b>{search,true}</b> — form for document search purposes with disabled validators.</p>
<h4>ROW</h4>
<p><b>{row,true}</b> — form for document row representation inside a table view.</p>
</ul>
</div>
<figure><code> new(Name,Object,Options) ->
#'div'{id=Name,body=io_lib:format("~tp",[Object,Options])}.</code></figure>
<h4>Module:doc() -> binary() | list().</h4>
<p>Retrieves the documentation string about this form module.</p>
<figure><code> doc() -> "simple".</code></figure>
</section>
<section>
<h3>FORM API</h3>
<h4>sources(Object :: tuple()) -> list().</h4>
<p>Returns the list of atoms that should be used as a value of <b>sources</b> field
of NITRO elements used for input data binding.</p>
<h4>type(Object :: record()) -> atom().</h4>
<p>Returns BEAM preloaded atom used as an object type. Usually second element of a tuple.</p>
<h4>kind(Options :: proplist()) -> atom().</h4>
<p>Transforms boolean tuples in options to atoms.</p>
<h4>pos(Object :: tuple(), #field{}) -> integer().</h4>
<p>Returins position of field in tuple by reffering to KVS metainfo.</p>
<h4>extract(Object :: tuple(), #field{}) -> term().</h4>
<p>Extracts the value from business object by a given field.</p>
<h4>evoke(Object :: tuple(), #field{}, Value :: term()) -> term().</h4>
<p>Evoke the new value of business object by a given field.</p>
<h4>dispatch(Object :: tuple(), Options :: proplist()) -> #element{}.</h4>
<p>Renders the business object to NITRO elements by reffering to FORM registry.</p>
<h4>new(#document{}, Object :: tuple(), Options :: proplist()) -> #element().</h4>
<p>Renders FORM document to NITRO element.</p>
<p>Evoke the new value of business object by a given field.</p>
<figure><code> > :form.new(:form_ok.new("name",otp(),[]),otp())
{:panel, :element, 'ok_name', [], [], [], [], [],
:form, [], [], [], [], [], [], [], [], [], [], [],
[{:panel, :element, [], [], [], [], [], [],
:caption, [], [], [], [], [], [], [], [], [], [], [],
[{:h4, :element, [], [], [], [], ...}], [], ...},
{:panel, :element, [], [], [], [], [], [],
:buttons, [], [], [], [], [], [], ...}], ...}</code></figure>
<figure><code> > :erlang.iolist_to_binary(
:nitro.render(
:form.new(
:form_ok.new("name",otp(),[]),otp())))
"<div id=\"ok_name\" class=\"form\"><div class=\"caption\"><h4>
Success Operation: CODE</h4></div><div class=\"buttons\"><a
class=\"button sgreen\" id=\"auto-422845\"
href=\"javascript:void(0);\">Confirm</a></div></div>"
</code></figure>
<br/>
<p>The following functions that are normally called from </b>new</b> builder:</p>
<h4>fields(#document{}, Object :: tuple(), Options :: proplists()) -> list(#element{}).</h4>
<p>Renders the form fields to NITRO elements.</p>
<h4>caption(#document{}, Object :: tuple(), Options :: proplists()) -> #panel{}.</h4>
<p>Renders the form caption to NITRO panel.</p>
<h4>buttons(#document{}, Object :: tuple(), Options :: proplists()) -> #panel{}.</h4>
<p>Renders the form buttons to NITRO panel.</p>
<p>The following functions that are normally called from </b>fields</b> builder:</p>
<h4>fieldType(#field{}, Acc :: list(#element{}), Object :: tuple(), Options :: proplists()) -> list(#element{}).</h4>
<p>Renders the particular field of a from inside a fields loop.</p>
<h4>fieldType(Type :: atom(), #field{}, Vector :: list(#element{}), Object :: tuple(), Options :: proplists()) -> list(#element{}).</h4>
<p>Renders the particular vector field of a from inside a fields loop. Normally called from fieldType/4.</p>
<br/>
<br/>
<br/>
</section>
<section>
<p>This module may refer to: MAN_MODULES</p>
</section>
</article>
</main>
<footer>2005—2019 © Synrc Research Center</footer>
<script>function drop(){document.getElementById("dropdown").classList.toggle("show");}</script>
</body></html>