• Stars
    star
    1,838
  • Rank 25,153 (Top 0.5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 9 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

JavaScript powered Forms with JSON Form Builder

JavaScript powered forms and SDK for Form.io

This library is a plain JavaScript form renderer and SDK for Form.io. This allows you to render the JSON schema forms produced by Form.io and render those within your application using plain JavaScript, as well as provides an interface SDK to communicate to the Form.io API's. The benefits of this library include.

  • Plain JavaScript implementation using ES6 and Modern practices (no jQuery, Angular, React, or any other framework dependency)
  • Renders a JSON schema as a webform and hooks up that form to the Form.io API's
  • Complete Form Builder which creates the JSON schema used to render the forms.
  • Nested components, layouts, Date/Time, Select, Input Masks, and many more included features
  • Full JavaScript API SDK library on top of Form.io

Form.io is Hiring!

If you like what you see, and would like to come and work for a cutting edge, Open Source core company, then please apply online @ https://form-talent.freshteam.com/jobs!

Examples and Demonstration

To find out more about this library as well as see a demonstration of what you can do with this library, go to the Examples and Demo site @ https://formio.github.io/formio.js

Installation

To install this SDK into your project, you can use the following command within your terminal.

npm install --save formiojs

Form Building

This library has a very powerful JSON form builder, and can be used like the following.

<html>
  <head>
    <link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css'>
    <link rel='stylesheet' href='https://cdn.form.io/formiojs/formio.full.min.css'>
    <script src='https://cdn.form.io/formiojs/formio.full.min.js'></script>
    <script type='text/javascript'>
      window.onload = function() {
        Formio.builder(document.getElementById('builder'), {}, {});
      };
    </script>
  </head>
  <body>
    <div id='builder'></div>
  </body>
</html>

This will create a robust Form builder embedded right within your own application. See Our Demo Page for an example.

Form Builder Documenation

Go to the Form Builder Documentation for a full documentation on how the open source form builder works.

Form Rendering

The following is a simple example on how to render a form within your HTML application.

<html>
  <head>
    <link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css'>
    <link rel='stylesheet' href='https://cdn.form.io/formiojs/formio.full.min.css'>
    <script src='https://cdn.form.io/formiojs/formio.full.min.js'></script>
    <script type='text/javascript'>
      window.onload = function() {
        Formio.createForm(document.getElementById('formio'), 'https://examples.form.io/example');
      };
    </script>
  </head>
  <body>
    <div id='formio'></div>
  </body>
</html>

This will render the following form within your application.

Alt text

You can also render JSON directly instead of referencing the embed URL from Form.io.

Formio.createForm(document.getElementById('formio'), {
  components: [
    {
      type: 'textfield',
      key: 'firstName',
      label: 'First Name',
      placeholder: 'Enter your first name.',
      input: true
    },
    {
      type: 'textfield',
      key: 'lastName',
      label: 'Last Name',
      placeholder: 'Enter your last name',
      input: true
    },
    {
      type: 'button',
      action: 'submit',
      label: 'Submit',
      theme: 'primary'
    }
  ]
});

This will render the JSON schema of the form within your application.

JSFiddle Example

A great way to play around with this renderer is to use JSFiddle, which serves as a good sandbox environment. Here is an example that you can fork and make your own!

http://jsfiddle.net/travistidwell/v38du9y1/

Form Renderer Documentation

For a more complete documentation of how to utilize this library within your application go to the Form Renderer documentation.

Wizard Rendering

This library can also be used to render a form wizard within your application using the same method as rendering a form. The determiniation on whether it should render as a wizard or not is based on the display property of the form schema being set to wizard.

<html>
  <head>
    <link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css'>
    <link rel='stylesheet' href='https://cdn.form.io/formiojs/formio.full.min.css'>
    <script src='https://cdn.form.io/formiojs/formio.full.min.js'></script>
    <script type='text/javascript'>
      window.onload = function() {
        Formio.createForm(document.getElementById('formio'), 'https://examples.form.io/wizard');
      };
    </script>
  </head>
  <body>
    <div id='formio'></div>
  </body>
</html>

Form Embedding

You can also use this library as a JavaScript embedding of the form using a single line of code. For example, to embed the https://examples.form.io/example form within your application you can simply use the following embed code.

<script src="https://cdn.form.io/formiojs/formio.embed.min.js?src=https://examples.form.io/example"></script>

For an example of how this looks and works, check out the following Form.io Form Embedding CodePen

Form Embedding Documentation

For a more complete documentation of how to embed forms, go to the Form Embedding Documentation.

JavaScript SDK

In addition to having a Form Renderer within this application, you can also use this library as a JavaScript SDK in your application. For example, to load a Form, and then submit that form you could do the following within your JavaScript.

<html>
  <head>
    <script src='https://cdn.form.io/formiojs/formio.full.min.js'></script>
    <script type='text/javascript'>
      var formio = new Formio('https://examples.form.io/example');
      formio.loadForm().then(function(form) {
      
        // Log the form schema.
        console.log(form);
        
        formio.saveSubmission({data: {
          firstName: 'Joe',
          lastName: 'Smith',
          email: '[email protected]'
        }}).then(function(submission) {
        
          // Log the full submission object.
          console.log(submission);
        });
      });
    </script>
  </head>
</html>

You can also use this within an ES6 application as follows.

import Formio from 'formiojs';
let formio = new Formio('https://examples.form.io/example');
formio.loadForm((form) => {
  console.log(form);
  formio.saveSubmission({data: {
    firstName: 'Joe',
    lastName: 'Smith',
    email: '[email protected]'
  }}).then((submission) => {
    console.log(submission);
  });
});

JavaScript SDK Documentation.

For more complete documentation over the JavaScript SDK, please take a look at the JavaScript SDK Documentation.

Full Developer API Documentation

To view the full SDK Documentation, go to Developer SDK Documentation

More Repositories

1

formio

A Form and Data Management Platform for Progressive Web Applications.
JavaScript
2,005
star
2

angular

JSON powered forms for Angular
TypeScript
634
star
3

react

JSON powered forms for React.js
TypeScript
301
star
4

ngFormBuilder

The Form.IO Form Builder Application
JavaScript
130
star
5

resquel

Easily convert your SQL database into a REST API using Express.js
TypeScript
121
star
6

vue

Javascript Powered forms and JSON form builder for Vue.js
TypeScript
118
star
7

ngFormio

JSON powered form rendering library for AngularJS + Form.io.
JavaScript
99
star
8

angular-demo

A Demo application with Angular + Form.io
TypeScript
62
star
9

react-app-starterkit

A react starterkit for creating new web applications with Form.io
TypeScript
56
star
10

aurelia-formio

Form.io JSON Forms and Form Builder for Aurelia
TypeScript
45
star
11

angular-material

JSON powered forms for Angular Material
TypeScript
45
star
12

help.form.io

The help site for Form.io
JavaScript
42
star
13

angular-app-starterkit

Angular 7 + Bootstrap 4 application starter kit using Form.io
TypeScript
40
star
14

formio-viewer

Landing page viewer for forms and wizards within Form.io
HTML
33
star
15

keycred

A key credential generator for Office 365 App-Only API applications.
JavaScript
20
star
16

contrib

Contributed components for Form.io
HTML
18
star
17

react-native-formio

React Native Version of Formio Renderer
JavaScript
18
star
18

formio-service

The Form.IO API Service library for Node.js applications
JavaScript
18
star
19

cli

The Form.io command line interface.
JavaScript
17
star
20

formio-php

PHP Integration with Form.io
PHP
13
star
21

vue-app-starterkit

Starterkit for building apps with form.io and vue
Vue
13
star
22

formio-webhook-receiver

An example webhook receiver application.
JavaScript
13
star
23

formio-app-formio

The Form.io main front-end application.
JavaScript
13
star
24

formio-app-servicetracker

JavaScript
11
star
25

ngFormioGrid

Provides a way to display Form.io submission data within the Angular UI-Grid.
JavaScript
11
star
26

uswds

JavaScript Powered Forms for the United States Web Design System
JavaScript
11
star
27

formio-app-basic

A basic starter Angular.js application with User Authentication using Form.io
JavaScript
9
star
28

formio-red

Form.io integration into Node Red - http://nodered.org
HTML
9
star
29

enterprise-release

Release notes for Enterprise Form.io Servers
9
star
30

formio-upload

A file upload server/proxy for use with the Form.io file component.
JavaScript
9
star
31

core

The Form.io Core Javascript Framework
TypeScript
9
star
32

formio-app-formbuilder

A user portal for creating and managing forms
JavaScript
8
star
33

bootstrap

Bootstrap templates for form.io forms
JavaScript
7
star
34

formio-wizard

Angular.js Wizard using Form.io forms.
JavaScript
7
star
35

sw-express

Extend express so it will work in service workers
JavaScript
6
star
36

ng-app-starterkit

An angular 1.x starterkit for creating new web applications with Form.io
JavaScript
6
star
37

ngFormioHelper

A library to help build Angluar.js applications on top of Form.io.
JavaScript
6
star
38

examples.form.io

Examples of Form.IO integration and implementation.
JavaScript
6
star
39

formio-app-gpstracker

An application that allows you to create trails and track GPS coordinates.
JavaScript
5
star
40

formio-app-humanresources

An form and data management application for Human Resources.
JavaScript
5
star
41

formio-workers

A library of workers for the Form.io platform.
JavaScript
5
star
42

formio-server-proxy

A proxy server for the Form.io Enterprise Server.
JavaScript
5
star
43

formio-app-eventmanager

A very basic Event Registration system built on top of Form.io.
JavaScript
5
star
44

formio-app-todo

An example ToDo application for Form.io.
JavaScript
5
star
45

formio-app-movie

An example application using the Form.IO platform.
JavaScript
4
star
46

api

A form manager module
TypeScript
4
star
47

aws-formio-deployment

Configurations for deploying Form.io into AWS
Roff
4
star
48

pdf-enterprise

PDF Server for Form.io Enterprise Server
CSS
4
star
49

edge

A highly performant and extensible Application Server for Form.io Multi-Tenant Deployments.
JavaScript
4
star
50

pdf-libs

The PDF Libraries
C++
3
star
51

cordova-offline-demo

Cordova Offline Application Demo
JavaScript
3
star
52

uswds-viewer

HTML
3
star
53

semantic

Semantic UI Templates for form.io
JavaScript
3
star
54

module-example

An example of how to create a module for the formio.js renderer and builder.
JavaScript
3
star
55

deploy

Deployment strategies for Form.io Enterprise platform
Smarty
3
star
56

generator-formio

A Yeoman Generator for creating Form.IO applications.
JavaScript
3
star
57

bulma

Bulma templates for formio.js
JavaScript
2
star
58

formio-question

A directive that provides question and answer capabilities for Form.io forms.
JavaScript
2
star
59

formio-app-salesquote

An example application in Form.io for managing sales quotes.
JavaScript
2
star
60

instructions

Instructions for using the private package repository
2
star
61

eventmanager

An Event Manager application built in Angular + Form.io
TypeScript
2
star
62

formio-translations-demo

An Angular 5 application that integrates PhraseApp with Form.io
TypeScript
2
star
63

portal

The Form.io Community Edition Portal
TypeScript
2
star
64

aurelia-app-starterkit

HTML
2
star
65

react-native-app

Makefile
1
star
66

pretty-checkbox

Adding pretty-checkbox plugin to Form.io forms
JavaScript
1
star
67

custom-renderer

An example custom renderer that extends the Form.io core renderer.
JavaScript
1
star
68

eslint-config-formio

The ESLint config for Form.io projects
JavaScript
1
star
69

formio-form

A basic Form.IO form template
HTML
1
star
70

lodash

A tiny (3kb gzipped) reduced-set implementation of the Lodash library.
JavaScript
1
star