Formio is a module that provides an implementation of FormClient interface called FormioClient. This implementation is based on Form.io form management platform.
When a form is requested FormioClient returns it with data which is in a system and matches to the form fields. The form can be taken from two places
in accordance to used resource loader. By default FormioClient loads forms and other resources from web context.
FormClient can make the decision if the submitted data should be processed (i.e. go through the whole validation lifecycle) or not. FormioClient makes this decision in
accordance to state field which is in the submitted data. state field is passed by Form.io Button Component that has property isSubmissionProcessed set to boolean value.
Basing on passed state FormioClient checks out corresponding isSubmissionProcessed value in the button definition and makes the decision whether submission should be processed or not.
If the decision to process submission is true then the next step is to pass validation (a.k.a dryValidationAndCleanUp). To perform this validation FormioClient requests Form.io engine
which is executed in a nodejs server that is run as an external process using OS's API. It not only validates data but also removes those fields from the data that does
not correspond to form fields. As Form.io engine does not return values that match disabled fields on a form, they are set explicitly.
-
Download and install NodeJs server. To check if it is installed correctly run
node -v && npm -v. -
Run
npm install -g jsdom jsdom-global formio.js. -
Set
npm root -gvalue toNODE_PATHenvironment variable.
-
Open
pom.xmlof your maven project. -
Add the repository:
<repository> <id>artezio</id> <url>https://nexus.artezio.net/repository/maven-releases</url> </repository>
-
Add the dependency:
<dependency> <groupId>com.artezio.forms</groupId> <artifactId>formio</artifactId> <version>{formio.version}</version> </dependency>
-
Download Formio Modeler and install Formio Modeler.
-
Create a form using Formio Modeler (see Creating Forms).
-
If you need to have an opportunity to cancel process evaluation and skip validation, you have to provide info about submission state:
- Add
Buttonto the form you are creating
- In an opened window on
Displaypage chooseActionequal toSave in stateand give a name to the state that will be passed (e.g.cancelled)
- On
APIpage add custom property with the nameisSubmissionProcessedand set the boolean value (e.g.false)
- Save settings
- Add
After that the state variable will be passed with the rest form fields and in accordance to the value of isSubmissionProcessed
variable the validation will either be performed or not.


