# chaincodedev-form-builder

> A customized dynamic form builder for react.

Latest version **2.4.6** (published 2023-05-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install chaincodedev-form-builder
pnpm add chaincodedev-form-builder
yarn add chaincodedev-form-builder
bun add chaincodedev-form-builder
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.4.6 |
| Published | 2023-05-17 |
| First published | 2021-07-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 46 |
| Unpacked size | 5.6 MB |
| Known vulnerabilities | 0 (+34 in 4 direct dependencies) |
| Install scripts | no |
| Author | Chaincode Consulting |
| Maintainers | chaincodedev |
| Keywords | react, react-component, form, builder, ui, drag, drop |

## Links

- npm: https://www.npmjs.com/package/chaincodedev-form-builder
- Repository: https://github.com/chaincodedev/obortech-form-builder
- Homepage: https://github.com/chaincodedev/obortech-form-builder#readme
- Issues: https://github.com/chaincodedev/obortech-form-builder/issues
- npm.io page: https://npm.io/package/chaincodedev-form-builder

## Dependencies (46)

- [xss](https://npm.io/package/xss.md) ^1.0.8
- [antd](https://npm.io/package/antd.md) ^4.23.1
- [next](https://npm.io/package/next.md) ^11.0.1
- [jspdf](https://npm.io/package/jspdf.md) ^2.5.1
- [beedle](https://npm.io/package/beedle.md) ^0.8.1
- [geolib](https://npm.io/package/geolib.md) ^3.3.3
- [leaflet](https://npm.io/package/leaflet.md) ^1.7.1
- [date-fns](https://npm.io/package/date-fns.md) ^2.16.1
- [draft-js](https://npm.io/package/draft-js.md) ^0.11.7
- [fbemitter](https://npm.io/package/fbemitter.md) ^3.0.0
- [react-dnd](https://npm.io/package/react-dnd.md) 11.1.3
- [array-move](https://npm.io/package/array-move.md) ^3.0.1
- [classnames](https://npm.io/package/classnames.md) ^2.2.6
- [prop-types](https://npm.io/package/prop-types.md) ^15.7.2
- [reactstrap](https://npm.io/package/reactstrap.md) 9.0.1
- [es6-promise](https://npm.io/package/es6-promise.md) ^4.2.8
- [file-loader](https://npm.io/package/file-loader.md) ^6.2.0
- [html2canvas](https://npm.io/package/html2canvas.md) ^1.4.1
- [react-select](https://npm.io/package/react-select.md) ^3.2.0
- [react-leaflet](https://npm.io/package/react-leaflet.md) 3.1.0
- [react-scripts](https://npm.io/package/react-scripts.md) ^5.0.1
- [draftjs-to-html](https://npm.io/package/draftjs-to-html.md) ^0.8.4
- [html-to-draftjs](https://npm.io/package/html-to-draftjs.md) ^1.5.0
- [moment-timezone](https://npm.io/package/moment-timezone.md) ^0.5.37
- [react-chartjs-2](https://npm.io/package/react-chartjs-2.md) ^2.11.1
- [isomorphic-fetch](https://npm.io/package/isomorphic-fetch.md) ^3.0.0
- [react-date-range](https://npm.io/package/react-date-range.md) ^1.4.0
- [react-datepicker](https://npm.io/package/react-datepicker.md) ^4.7.0
- [react-star-rating](https://npm.io/package/react-star-rating.md) ^1.4.2
- [styled-components](https://npm.io/package/styled-components.md) ^5.3.5
- [react-sortable-hoc](https://npm.io/package/react-sortable-hoc.md) ^2.0.0
- [webpack-dev-server](https://npm.io/package/webpack-dev-server.md) ^3.11.2
- [@next-tools/dynamic](https://npm.io/package/@next-tools/dynamic.md) ^0.0.11
- [@react-leaflet/core](https://npm.io/package/@react-leaflet/core.md) 1.0.2
- [babel-preset-es2015](https://npm.io/package/babel-preset-es2015.md) ^6.24.1
- [immutability-helper](https://npm.io/package/immutability-helper.md) ^3.1.1
- [react-draft-wysiwyg](https://npm.io/package/react-draft-wysiwyg.md) ^1.13.2
- [react-bootstrap-slider](https://npm.io/package/react-bootstrap-slider.md) ^2.2.3
- [react-signature-canvas](https://npm.io/package/react-signature-canvas.md) ^1.0.5
- [react-dnd-html5-backend](https://npm.io/package/react-dnd-html5-backend.md) 11.1.3
- [react-textarea-autosize](https://npm.io/package/react-textarea-autosize.md) ^7.1.2
- [chartjs-plugin-annotation](https://npm.io/package/chartjs-plugin-annotation.md) ^0.5.7
- [react-bootstrap-sweetalert](https://npm.io/package/react-bootstrap-sweetalert.md) ^4.4.1
- [react-leaflet-google-layer](https://npm.io/package/react-leaflet-google-layer.md) ^2.0.5
- [react-filerobot-image-editor](https://npm.io/package/react-filerobot-image-editor.md) ^4.0.0-beta.38
- [leaflet-simple-map-screenshoter](https://npm.io/package/leaflet-simple-map-screenshoter.md) ^0.5.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.4.6 (latest) — 2023-05-17
- 2.4.5 — 2023-05-17
- 2.4.4 — 2023-05-16
- 2.4.3 — 2023-05-16
- 2.4.2 — 2023-05-16
- 2.4.1 — 2023-05-16
- 2.4.0 — 2023-05-16
- 2.3.9 — 2023-05-12
- 2.3.8 — 2023-05-11
- 2.3.7 — 2023-05-04
- 2.3.6 — 2023-04-27
- 2.3.5 — 2023-04-26
- 2.3.2 — 2023-04-26
- 2.3.1 — 2023-04-21
- 2.3.0 — 2023-04-21
- … 226 more at https://npm.io/package/chaincodedev-form-builder/versions

## README

[![npm version](https://badge.fury.io/js/react-form-builder2.svg)](//npmjs.com/package/react-form-builder2)
[![downloads](https://img.shields.io/npm/dm/react-form-builder2.svg)](https://img.shields.io/npm/dm/react-form-builder2.svg)

Fork of [Form-Builder By Kiho](https://github.com/kiho/react-form-builder#readme)
# 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](https://kiho.github.io/react-form-builder/) Slow Loading.... back-end is running at FREE Heroku.

![](screenshot.png)

### Editing Items
![](screenshot2.png)

# Basic Usage

```javascript
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

```javascript
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.

```javascript
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

Name | Type | Required? | Description
--- | --- | --- | ---
form_action | string | Required | URL path to submit the form
form_method | string | Required | Verb used in the form submission.
action_name | string | Optional | Defines form submit button text.  Defaults to "Submit"
onSubmit | function | optional | Invoke when submit data, if exists will override form post.
data | array | Required | Question data retrieved from the database
back_action | string | Optional | URL path to go back if needed.
back_name | string | Optional | Button text for back action.  Defaults to "Cancel".
task_id | integer | Optional | User to submit a hidden variable with id to the form on the backend database.
answer_data | array | Optional | Answer data, only used if loading a pre-existing form with values.
authenticity_token | string | Optional | If using Rails and need an auth token to submit form.
hide_actions | boolean | Optional | If you would like to hide the submit / cancel buttons set to true.
skip_validations | boolean | Optional | Suppress form validations on submit, if set to true.
display_short | boolean | Optional | Display 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_only | boolean | Optional | Shows a read only version which has fields disabled and removes "required" labels.
variables | object | Optional | Key/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.

![](screenshot3.png)

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](https://github.com/Kiho/react-form-builder/blob/master/public/index.html#L5) 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
```bash
$ 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
- [Basic](https://github.com/Kiho/react-form-builder/tree/master/examples/demo)
- [JSON Post](https://github.com/Kiho/react-form-builder/tree/master/examples/custom)
- [UMD](https://github.com/Kiho/react-form-builder/tree/master/examples/umd)
- [NEXT](https://github.com/Kiho/react-form-builder/tree/master/examples/next)
- [NEXT-Mongo](https://github.com/Kiho/react-form-builder/tree/master/examples/mongo)
- [create-react-app](https://github.com/Kiho/react-form-builder/tree/master/examples/cra)

# Tests
```bash
$ 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",

---
_Source: https://npm.io/package/chaincodedev-form-builder · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
