FORMS: User Applications

FORMS application provides set of CSS stylesheets for compact forms definitions and also it provides database model for storing metadata information about documents, fields and validations.


The basic idea that stands behind form models is that N2O forms are able to be generated from its metamodel which is also a root for other generated persisted Erlang records for KVS storage. N2O book is the best for the taxonomy of N2O forms and KVS interface. This kind of metainterpretation and unification of containers is usual for enterprise and common object oriented systems.


Metainformation declares the documents (#document) and its fields (#field) which forms a document level entity that can be stored in database. Usually somewhere in ACT or in DBS applications you can find its document definition in Erlang records which is entered with forms.


JavaScript Web Application is generated using Metainformation and Data Model. N2O is used as DSL language for forms generation. JavaScript/OTP is also used for forms generation. Forms average render speed is 50 FPS (forms per second).


The #document object is an application form definition. It consists of sections (#sec) that include fields with its descriptions and validations.

-record(document, { ?ITERATOR(feed), name, base, sections, fields, buttons, access }).


Each section #sec of forms are entitled with heading font.

-record(sec, { id, name, desc="" }).


Forms are given with its control buttons (#but). The information from field postback in button is directly translated to N2O element postback during forms:new/2.

-record(but, { id, postback, name, title, sources=[], class }).


-record(opt, { id, name, title, postback, checked=false, disabled=false, noRadioButton=false }). -record(sel, { id, name, title, postback }). -record(field, { id, sec=1, name, pos, title, layout, visible=true, disabled=false, format="~w", curr="", postfun=[], desc, wide=normal, type=binary, etc, labelClass=label, fieldClass=field, boxClass=box, access, tooltips=[], options=[], min=0, max=1000000, length=10, postback }).


Since document consists of validations and fields, here is their record definitions in FORMS model:

-record(validation, { name, type, msg, extract = fun(X) -> X end, options=[], function, field={record,pos} }).

Domain Model

KVS Data Model is being generated from its metainformation. KVS layer provide persistence facilities. Buy you can defined your document ad-hoc by declaring good known Erlang record.

-record(phone, { ?ITERATOR(feed), number = "+380676631870" }).


Document encoding

document(Name,Phone) -> #document { name = Name, sections = [ #sec { name=[<<"Input the password " "you have received by SMS"/utf8>>, wf:to_list(Phone#phone.number)] } ], buttons = [ #but { name='decline', title=<<"Cancel"/utf8>>, class=cancel, postback={'CloseOpenedForm',Name} }, #but { name='proceed', title = <<"Proceed"/utf8>>, class = [button,sgreen], sources = [otp], postback = {'Spinner',{'OpenForm',Name}}}], fields = [ #field { name='otp', type=otp, title= <<"Password:"/utf8>>, labelClass=label, fieldClass=column3}]}.


The above form is being automatically rendered to N2O forms which can be later rendered to XML, HTML, Windows or Cocoa code.

form(Name,Phone) -> #panel{id=deposits:atom([form,Name]),class=line,body=[ #panel{id=form,class=form,body=[ #panel{class=caption,body=[ #h4{body= <<"Input the password " "you have received by SMS"/utf8>>}, #h3{body= Phone#phone.number} ]}, #panel{class=row,body=[ #panel{class=label,body= <<"Password:"/utf8>>}, #panel{class=field,body= #input{id=otp,onkeypress="searchKeyPress(event);"}}]}, #panel{class=buttons,body=[ #link{class=decline, postback={'CloseOpenedForm',Name}, body= <<"Cancel"/utf8>>}, #link{id=proceed, source=[otp], postback={'OpenForm',Name}, class= [button,sgreen], body= <<"Proceed"/utf8>>}]} ]}]}.

Picture. OTP Form Sample


Validation Rules

Validation rules should be applied by developer. Erlang and JavaScript/OTP is used to define validation rules applied to documents during workflow.

Form Autogeneration

XForms and XMPP Data Forms

The other well known standard is XForms that could be easily converted to both directions by FORMS application. XForms W3C standard strives to be supported by browsers. The other XML forms standard is XEP-0004 Data Forms which is supported by most XMPP clients:

<x xmlns='jabber:x:data' type='{form-type}'> <title/> <instructions/> <desc/> <field var='OS' type='int' label='description'> <value>3</value> <option label='Windows'><value>3</value></option> <option label='Mac'> <value>2</value></option> <option label='Linux'> <value>1</value></option> </field> </x>


Events | Privacy Policy | Feedback | Brandbook
Copyright © 2005–2018 Synrc Research Center s.r.o.