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" }
- Example:
textarea
: string;- Example:
{ id: "field_id", value: "my value" }
- Example:
thumbs
: "thumbUp" | "thumbDown";- Example:
{ id: "field_id", value: "thumbDown" }
- Example:
stars1to5
: string;- Example:
{ id: "field_id", value: "3" }
- Example:
radio
: string (name of option);- Example:
{ id: "field_id", value: "option name" }
- Example:
select
: string (name of option);- Example:
{ id: "field_id", value: "option name" }
- Example:
checkbox
: Array of strings;- Example:
{ id: "field_id", value: ["option name", "Another name"] }
- Example:
Create id
To create a id, open form flow and write a reference id for your field.
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")