Current section

Files

Jump to
form man form.htm
Raw

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.space">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://n2o.space/img/Synrc Neo.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>CALLBACK API</h3>
<p>The FORMS 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>
<ul><li><b>{edit,true}</b> — form for editing purposes.</li>
<li><b>{new,true}</b> — form for document creation purposes.</li>
<li><b>{view,true}</b> — form for document read only view mode.</li>
<li><b>{search,true}</b> — form for document search purposes with disabled validators.</li>
<li><b>{row,true}</b> — form for document row representation inside a table view.</li>
</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>STATIC API</h3>
<h4>new(Form :: #document{}, BusinessObject :: tuple()) -> binary() | list().</h4>
<p>Renders the form fullfilled with values from a given business object.</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())))
"&lt;div id=\"ok_name\" class=\"form\"&gt;&lt;div class=\"caption\"&gt;&lt;h4&gt;
Success Operation: CODE&lt;/h4&gt;&lt;/div&gt;&lt;div class=\"buttons\"&gt;&lt;a
class=\"button sgreen\" id=\"auto-422845\"
href=\"javascript:void(0);\"&gt;Confirm&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;"
</code></figure>
<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>