2.4.6 • Published 12 months ago

chaincodedev-form-builder v2.4.6

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

npm version downloads

Fork of Form-Builder By Kiho

React Form Builder 2

A complete react form builder that interfaces with a json endpoint to load and save generated forms.

  • Upgraded to React 16.8.6
  • Bootstrap 4.x, Font-Awesome 5.x
  • Use react-dnd for Drag & Drop
  • Save form data with dummy api server
  • Show posted data on readonly form
  • Multi column row

DEMO Slow Loading.... back-end is running at FREE Heroku.

npm.io

Editing Items

npm.io

Basic Usage

import React from 'react';
import ReactDOM from 'react-dom';
import { ReactFormBuilder } from 'react-form-builder2';
import 'react-form-builder2/dist/app.css';

ReactDOM.render(
  <ReactFormBuilder />,
  document.body
)

Props

var items = [{
  key: 'Header',
  name: 'Header Text',
  icon: 'fa fa-header',
  static: true,
  content: 'Placeholder Text...'
},
{
  key: 'Paragraph',
  name: 'Paragraph',
  static: true,
  icon: 'fa fa-paragraph',
  content: 'Placeholder Text...'
}];

<ReactFormBuilder
  url='path/to/GET/initial.json'
  toolbarItems={items}
  saveUrl='path/to/POST/built/form.json' />

React Form Generator

Now that a form is built and saved, let's generate it from the saved json.

import React from 'react';
import ReactDOM from 'react-dom';
import { ReactFormGenerator } from 'react-form-builder2';
import 'react-form-builder2/dist/app.css';

ReactDOM.render(
  <ReactFormGenerator
    form_action="/path/to/form/submit"
    form_method="POST"
    task_id={12} // Used to submit a hidden variable with the id to the form from the database.
    answer_data={JSON_ANSWERS} // Answer data, only used if loading a pre-existing form with values.
    authenticity_token={AUTH_TOKEN} // If using Rails and need an auth token to submit form.
    data={JSON_QUESTION_DATA} // Question data
  />,
  document.body
)

Form Params

NameTypeRequired?Description
form_actionstringRequiredURL path to submit the form
form_methodstringRequiredVerb used in the form submission.
action_namestringOptionalDefines form submit button text. Defaults to "Submit"
onSubmitfunctionoptionalInvoke when submit data, if exists will override form post.
dataarrayRequiredQuestion data retrieved from the database
back_actionstringOptionalURL path to go back if needed.
back_namestringOptionalButton text for back action. Defaults to "Cancel".
task_idintegerOptionalUser to submit a hidden variable with id to the form on the backend database.
answer_dataarrayOptionalAnswer data, only used if loading a pre-existing form with values.
authenticity_tokenstringOptionalIf using Rails and need an auth token to submit form.
hide_actionsbooleanOptionalIf you would like to hide the submit / cancel buttons set to true.
skip_validationsbooleanOptionalSuppress form validations on submit, if set to true.
display_shortbooleanOptionalDisplay an optional "shorter page/form" which is common for legal documents or situations where the user will just have to sign or fill out a shorter form with only the critical elements.
read_onlybooleanOptionalShows a read only version which has fields disabled and removes "required" labels.
variablesobjectOptionalKey/value object that can be used for Signature variable replacement.

Read only Signatures

Read only signatures allow you to use a saved/canned signature to be placed into the form. The signature will be passed in through the variables property to ReactFormGenerator and ReactFormBuilder.

To use a read only signature, choose the "Read only" option and enter the key value of the variable that will be used to pass in the signature.

npm.io

The signature data should be in base 64 format.

There is a variables.js file that contains a sample base 64 signature. This variable is passed into the demo builder and generator for testing. Use the variable key "JOHN" to test the variable replacement.

Vendor Dependencies

In order to make the form builder look pretty, there are a few dependencies other than React. Style sheets from Bootstrap and FontAwesome must be added to index.html. See the example code in index.html for more details.

  • Bootstrap
  • FontAwesome

SASS

All relevant styles are located in css/application.css.scss.

Develop

First we need to start obortech admin project because in file upload component we are storing the uploaded file from the server so at first we need to start the obortech admin in http://localhost:4000

$ npm install
$ npm run build:dist
$ npm run serve:api
$ npm start

Then navigate to http://localhost:8080/ in your browser and you should be able to see the form builder in action.

Examples

Tests

$ npm test

Test is not working at this moment.

Issues

if you face any unknown issues after deployed in live on form builder file upload or file edit that maybe because of the react-filerobot-image-editor version we need to find the correct version and use that. right now im using "react-filerobot-image-editor": "^4.0.0-beta.38",

2.4.1

12 months ago

2.4.0

12 months ago

2.4.3

12 months ago

2.4.2

12 months ago

2.4.5

12 months ago

2.4.4

12 months ago

2.4.6

12 months ago

2.3.0

1 year ago

2.3.2

1 year ago

2.3.1

1 year ago

2.3.6

1 year ago

2.3.5

1 year ago

2.2.3

1 year ago

2.2.2

1 year ago

2.2.5

1 year ago

2.2.4

1 year ago

2.2.7

1 year ago

2.2.6

1 year ago

2.3.8

12 months ago

2.3.7

12 months ago

2.3.9

12 months ago

2.2.9

1 year ago

2.2.8

1 year ago

2.2.10

1 year ago

2.2.1

1 year ago

2.2.0

1 year ago

2.1.2

1 year ago

2.1.1

1 year ago

2.1.4

1 year ago

2.1.3

1 year ago

2.1.5

1 year ago

2.1.8

1 year ago

2.1.7

1 year ago

2.0.26

1 year ago

2.0.27

1 year ago

2.0.24

1 year ago

2.0.25

1 year ago

2.0.22

1 year ago

2.0.23

1 year ago

2.0.20

1 year ago

2.0.21

1 year ago

2.0.28

1 year ago

2.0.29

1 year ago

2.0.33

1 year ago

2.0.31

1 year ago

2.0.32

1 year ago

2.0.30

1 year ago

2.0.15

1 year ago

2.0.16

1 year ago

2.0.13

1 year ago

2.0.14

1 year ago

2.0.11

1 year ago

2.0.12

1 year ago

2.0.10

1 year ago

2.0.19

1 year ago

2.0.17

1 year ago

2.0.18

1 year ago

2.0.3

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.9

1 year ago

2.0.8

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

0.8.9

1 year ago

0.8.8

1 year ago

0.8.5

1 year ago

0.8.7

1 year ago

0.8.6

1 year ago

1.2.1

1 year ago

0.7.2

1 year ago

0.7.1

1 year ago

0.7.4

1 year ago

0.7.3

1 year ago

1.1.1

1 year ago

0.9.8

1 year ago

1.1.0

1 year ago

0.9.7

1 year ago

0.9.9

1 year ago

0.9.4

1 year ago

0.9.3

1 year ago

0.9.6

1 year ago

0.9.5

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

0.8.1

1 year ago

0.8.0

1 year ago

0.8.3

1 year ago

0.8.2

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.6.7

1 year ago

0.6.6

1 year ago

0.6.9

1 year ago

0.6.8

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

0.9.0

1 year ago

0.9.2

1 year ago

0.9.1

1 year ago

0.7.9

1 year ago

0.7.6

1 year ago

0.7.5

1 year ago

0.7.8

1 year ago

0.7.7

1 year ago

0.7.0

1 year ago

0.5.8

2 years ago

0.5.7

2 years ago

0.5.9

2 years ago

0.5.6

2 years ago

0.6.3

1 year ago

0.6.2

1 year ago

0.6.5

1 year ago

0.6.4

1 year ago

0.6.1

1 year ago

0.6.0

1 year ago

0.5.4

2 years ago

0.5.3

2 years ago

0.5.5

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.4.48

2 years ago

0.4.49

2 years ago

0.4.46

2 years ago

0.4.47

2 years ago

0.4.75

2 years ago

0.4.73

2 years ago

0.4.74

2 years ago

0.4.71

2 years ago

0.4.72

2 years ago

0.4.70

2 years ago

0.4.64

2 years ago

0.4.65

2 years ago

0.4.62

2 years ago

0.4.63

2 years ago

0.4.60

2 years ago

0.4.61

2 years ago

0.4.68

2 years ago

0.4.69

2 years ago

0.4.66

2 years ago

0.4.67

2 years ago

0.4.53

2 years ago

0.4.54

2 years ago

0.4.51

2 years ago

0.4.52

2 years ago

0.4.50

2 years ago

0.4.59

2 years ago

0.4.57

2 years ago

0.4.58

2 years ago

0.4.55

2 years ago

0.4.56

2 years ago

0.4.42

2 years ago

0.4.43

2 years ago

0.4.40

2 years ago

0.4.41

2 years ago

0.4.44

2 years ago

0.4.45

2 years ago

0.4.39

2 years ago

0.4.37

2 years ago

0.4.38

2 years ago

0.4.31

2 years ago

0.4.32

2 years ago

0.4.30

2 years ago

0.4.35

2 years ago

0.4.36

2 years ago

0.4.33

2 years ago

0.4.34

2 years ago

0.4.29

2 years ago

0.4.9

2 years ago

0.4.20

2 years ago

0.4.21

2 years ago

0.4.28

2 years ago

0.4.26

2 years ago

0.4.27

2 years ago

0.4.24

2 years ago

0.4.25

2 years ago

0.4.22

2 years ago

0.4.23

2 years ago

0.4.19

2 years ago

0.4.10

2 years ago

0.4.17

2 years ago

0.4.18

2 years ago

0.4.15

2 years ago

0.4.16

2 years ago

0.4.13

2 years ago

0.4.14

2 years ago

0.4.11

2 years ago

0.4.12

2 years ago

0.4.8

3 years ago

0.4.5

3 years ago

0.4.4

3 years ago

0.4.7

3 years ago

0.4.6

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.4.3

3 years ago

0.4.2

3 years ago

0.3.9

3 years ago

0.3.0

3 years ago

0.3.6

3 years ago

0.2.7

3 years ago

0.3.5

3 years ago

0.2.6

3 years ago

0.3.8

3 years ago

0.2.9

3 years ago

0.3.7

3 years ago

0.2.8

3 years ago

0.3.2

3 years ago

0.2.3

3 years ago

0.3.1

3 years ago

0.3.4

3 years ago

0.2.5

3 years ago

0.3.3

3 years ago

0.2.4

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.1.0

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago