Home Reference Source
import Form from 'formiojs/src/Form.js'
public class | source

Form

Extends:

src/Element.js~Element → Form

Direct Subclass:

FormBuilder

Static Method Summary

Static Public Methods
public static

embed(embed: *): *

Constructor Summary

Public Constructor
public

constructor(element: Object, form: Object | string, options: Object)

Creates an easy to use interface for embedding webforms, pdfs, and wizards into your application.

Member Summary

Public Members
public
public

element: *

public set

form(formParam: string | object): *

Sets the form.

public get

form: object: *

Returns the loaded forms JSON.

public
public

options: *

public

ready: *

public
public
Private Members
private

_form: *

Method Summary

Public Methods
public

attach(element: *): *

public

build(): Promise<T>

Build a new form.

public

create(display: string): *

Create a new form instance provided the display of the form.

public

empty()

public

errorForm(err: *): {"components": *}

public

getSubmission(formio: *): *

public

render(): *

public

sanitize(string: *): *

Sanitize an html string.

public

setContent(element: *, content: *, forceSanitize: *): boolean

public

setDisplay(display: string): Promise<T>

Changes the display of the form.

public

setForm(formParam: *): *

Static Public Methods

public static embed(embed: *): * source

Params:

NameTypeAttributeDescription
embed *

Return:

*

Public Constructors

public constructor(element: Object, form: Object | string, options: Object) source

Creates an easy to use interface for embedding webforms, pdfs, and wizards into your application.

Params:

NameTypeAttributeDescription
element Object

The DOM element you wish to render this form within.

form Object | string

Either a Form JSON schema or the URL of a hosted form via. form.io.

options Object

The options to create a new form instance.

options.readOnly boolean

Set this form to readOnly

options.noAlerts boolean

Set to true to disable the alerts dialog.

options.i18n boolean

The translation file for this rendering. @see https://github.com/formio/formio.js/blob/master/i18n.js

options.template boolean

Provides a way to inject custom logic into the creation of every element rendered within the form.

Example:

import Form from 'formiojs/Form';
const form = new Form(document.getElementById('formio'), 'https://examples.form.io/example');
form.build();

Public Members

public display: string source

public element: * source

public set form(formParam: string | object): * source

Sets the form. Either as JSON or a URL to a form JSON schema.

Return:

*

public get form: object: * source

Returns the loaded forms JSON.

Return:

object

The loaded form's JSON

public instance: * source

public options: * source

public ready: * source

public readyReject: * source

public readyResolve: * source

Private Members

private _form: * source

Public Methods

public attach(element: *): * source

Params:

NameTypeAttributeDescription
element *

Return:

*

public build(): Promise<T> source

Build a new form.

Return:

Promise<T>

public create(display: string): * source

Create a new form instance provided the display of the form.

Params:

NameTypeAttributeDescription
display string

The display of the form, either "wizard", "form", or "pdf"

Return:

*

public empty() source

public errorForm(err: *): {"components": *} source

Params:

NameTypeAttributeDescription
err *

Return:

{"components": *}

public getSubmission(formio: *): * source

Params:

NameTypeAttributeDescription
formio *

Return:

*

public render(): * source

Return:

*

public sanitize(string: *): * source

Sanitize an html string.

Params:

NameTypeAttributeDescription
string *

Return:

*

public setContent(element: *, content: *, forceSanitize: *): boolean source

Params:

NameTypeAttributeDescription
element *
content *
forceSanitize *

Return:

boolean

public setDisplay(display: string): Promise<T> source

Changes the display of the form.

Params:

NameTypeAttributeDescription
display string

The display to set this form. Either "wizard", "form", or "pdf"

Return:

Promise<T>

public setForm(formParam: *): * source

Params:

NameTypeAttributeDescription
formParam *

Return:

*