React SDK

Start of documentation content

The Formally React SDK allows developers to make bespoke customisations such as,

  • creating forms in code
  • custom form submit handler to send data to your own servers
  • replacing default components, such as textboxes, with your components
  • custom validation logic
  • custom file upload handler to send file uploads to your own servers
  • custom autosuggest handler to integrate with your APIs / data.
  • custom analytics

All of these features can be used independently.

Install

The SDK software is included in the same NPM formally package.

Licensing via the licence prop

You can trial the SDK locally (on localhost) without a licence but deploying to another domain will require an SDK licence.

A SDK licence is not required if only using the formBuilderId prop to load forms from Formally servers via the form builder. Use of other props will need an SDK licence.

The licence is a string that is provided through the licence prop e.g.

import { Formally } from 'formally';
import 'formally/build/styles.min.css';

export const MyForm = () => (
  <Formally licence="your-licence-id" formBuilderId="your-form-id" />
);

Storing unsubmitted answers in storage

Formally can save unsubmitted answers in browser storage (localStorage).

Answers will be saved automatically if you're using "formBuilderId" however if you're designing forms using the data prop or JSX form components then to use this feature you'll need to provide a formCacheKey prop.

Provide a formCacheKey prop with a value that is unique to your form (ie, data-formallycachekey="dog-form"). This will be used for a localStorage key.