Superform by Delta Clan
✨ ClonablesSocialResourcesSuperform Home
v2
v2
  • 🏁Getting Started
    • Introduction
    • Quick Start
  • 🫀Essentials
    • Form Container
    • Step Container
    • Navigation - Overview
      • Direct
      • Logic / Conditional
      • Hook
    • Variables
      • Form Data ($f)
      • Step Index ($s)
      • Progress Percentage ($p)
      • Scoring Variables ($v)
    • Progress Bar
    • Reset
    • Radio Groups
    • Checkbox Groups
    • Cheatsheet
  • ⚙️Global Options
    • Step Delay Controls
    • Animations
      • Step Animation
      • Step Animation Duration
      • Step Animation Ease
    • Save Data & Progress
    • Pre-fill Form
    • Prevent Content Flash
    • Debug
    • Third-party Integrations
    • Cheatsheet
  • 🎛️Input Validation & Errors
    • Validation
      • length()
      • words()
      • minmax()
      • checkbox()
      • must()
      • hook()
    • Error Management
      • Automatic Error Setup
      • Manual Error Setup
  • ⚡Reactivity
    • Update Text
    • Visibility
    • Class Toggle
    • Value
    • Set Attribute
  • 🔢Score Tracking
    • Score Setup & Calculation
    • Score Ranking
  • ⌨️Accessibility
    • Enter & Backspace Bindings (↩, ⌫)
    • Checkbox & Radio Bindings
  • 🛠️Javascript SDK
    • Intro to Superform API
    • Superform Instance
    • Cheatsheet
  • 📖Additional Resources
    • WTF is an expression ? 🆕
    • Integrations
    • Tutorials
    • Changelog
    • FAQ 🚧
    • Join Discord
Powered by GitBook
On this page
  • Summary
  • Initialization and Form Retrieval Methods
  • Form Instance Methods
  • Hook Methods

Was this helpful?

  1. Javascript SDK

Cheatsheet

Quick reference to the essential API methods, parameters, return types, and descriptions.

Summary

↳ Initialization and Form Retrieval Methods

↳ Form Instance Methods

↳ Hook Methods


Initialization and Form Retrieval Methods

Method
Parameters
Returns
Description

new Superform(formName)

formName: string

Form Instance

Initializes a Superform instance for the specified form container.

getForm(formName)

formName: string

Form Instance or undefined

Retrieves a Superform instance by name if it exists.

allForms()

None

Array

Returns an array containing all initialized Superform instances.


Form Instance Methods

Method
Parameters
Returns
Description

getFormData()

None

Object

Retrieves form values as an object.

beforeStepChange(fn)

fn: function

None

Registers a listener executed before a step change.

onStepChange(fn)

fn: function

None

Registers a listener executed on a step change.

onFormSubmit(fn)

fn: function

None

Registers a listener executed when the form is submitted.

Params Object for Step and Form Submit Methods

Property
Type
Description

data

Object

The current form data

stepCount

Number

The current step index

progress

Number

The current progress percentage (0-100)

scores

Object

Contains score data


Hook Methods

Method
Parameters
Returns
Description

registerNavigationHook(hookName, fn)

hookName: string, fn: function

Registers a custom navigation hook for dynamic navigation logic.

registerInputValidationHook(hookName, fn)

hookName: string, fn: function

Boolean

Registers a custom validation hook for form inputs.

Return Types for registerNavigationHook:

Return Type
Description

string or Promise<string>

Step Teleport by step name indicating the next step name.

"next", "prev", "previous", "back" or Promise<Linear Instruction>

Linear navigation instruction.

Signed number as string or Promise<Step teleport string>

Step Teleport by signed number navigation instruction.

hook(HOOK_NAME) or Promise<"hook(HOOK_NAME)">

Hook navigation instruction.

Last updated 11 months ago

Was this helpful?

🛠️
Various