Skip to main content

Methods

destroy

Removes all listeners and references.

const form = new Imbox.Form("imbox-form", {})

form.destroy()

setValue

Sets form field value. Same as setValues but singular value insted of array.

Example:

const form = new Imbox.Form("imbox-form", {})

form.setValue("field_id", "my value")

setValues

Sets form field values.

Example:

const form = new Imbox.Form("imbox-form", {})

form.setValues([
{ id: "field_id", value: "my value" },
{ id: "field_id_2", value: ["my value 2"] }
])

Field data formats:

  • textfield: string;
    • Example: { id: "field_id", value: "my value" }
  • textarea: string;
    • Example: { id: "field_id", value: "my value" }
  • thumbs: "thumbUp" | "thumbDown";
    • Example: { id: "field_id", value: "thumbDown" }
  • stars1to5: string;
    • Example: { id: "field_id", value: "3" }
  • radio: string (name of option);
    • Example: { id: "field_id", value: "option name" }
  • select: string (name of option);
    • Example: { id: "field_id", value: "option name" }
  • checkbox: Array of strings;
    • Example: { id: "field_id", value: ["option name", "Another name"] }

Create id

To create a id, open form flow and write a reference id for your field.

Example banner

submit

Submits form.

const form = new Imbox.Form("imbox-form", {})

form.submit()

validate

checks if form is valid and displays potential messages to user.

const form = new Imbox.Form("imbox-form", {})

form.validate()

setLanguage

Sets language to your desire, setLanugage takes a string in form of a language code.

const form = new Imbox.Form("imbox-form", {})

form.setLanguage("sv")