Intro to Superform API
Harness the full power of Superform with our JavaScript SDK.
Last updated
Was this helpful?
Harness the full power of Superform with our JavaScript SDK.
Last updated
Was this helpful?
Initializing the Superform API is pretty simple. Check out this JavaScript example below:
Superform is powerful — out of the box. However, if something is not supported and you wish to extend Superform's functionalities, you can use the Superform API. We picked the best use cases you might want to use the Superform API for:
The following APIs are available to interact with Superform.
Superform
ClassWith the Superform
class, you can manually initialize Superform. Make sure not to include the sf
attribute on your form container.
formName
string
The name or selector of the form container
Returns
A form instance
Superform Instance
Returns a Superform instance associated with the specified container
getForm(formName)
Allows you to get a form by name if it is auto-initialized using the sf
attribute.
formName
string
The name of the form to retrieve
Returns
A form instance
Superform Instance
Returns a Superform instance if it exists, otherwise undefined
allForms()
Allows you to get an array of all initialized Superform instances.
All forms
Array
An array containing all Superform instances
For advanced control of Superform instances and learn how to:
Retrieve Form Data: Access form values programmatically with getFormData
.
Event Listeners: Utilize beforeStepChange
, onStepChange
, and onFormSubmit
for custom actions.
Register Hooks: Implement custom logic using registerInputValidationHook
and registerNavigationHook
.
Visit the Superform Instance documentation.