Basic Properties

Basic properties

NameDescriptionType
classNameName of class attribute assigned to the root form element
nameThe name of the formOptional
configConfiguration options for the form. Read moreOptional
dataContains initial form data values when the form is loaded. Read moreOptional
schemaJSON-based schema for rendering the form. Read moreMandatory
controlsCustom fields. Read moreOptional
componentsCustom template components mapped with schema using displayType property as template. Read moreOptional
pageNumberThe default tab on opening the form (grouped form)Optional
lastPageNumberThe last page number will exclude any tabs that appear after the lastPageNumber tabOptional
onChangeA function that will be called whenever the value of a field changes. The second parameter provided to this function contains the complete form data.Optional
onErrorA function that will be called whenever there is an error with a field.Optional
onNextA function that will be called when when the user attempts to navigate to the next section of a grouped form.Optional
onPreviousA function that will be called when when the user attempts to navigate to the previous section of a grouped formOptional
onSubmitA function that will be called when the form is submittedMandatory
changeResponseModeValue: "form-data", "section-data", "default".
form-data: onChange event will pass all the form data as a second parameter.
section-data: onChange event will pass all the section data as a second parameter.
Optional
nextResponseModeValue: "form-data", "page-data"
form-data: onNext event will send all the form data (onNext).
page-data: onNext event will send all the date of the current page.
Note: onNext is triggered on click of Next button
Optional

onNext, onSubmit

It accepts the following three arguments:

  • formData
  • pageNumber
  • setErrors

Return type of onNext, onSubmit

  • boolean or Promise<boolean>

If return type is a Promise, the step will move forward only if the Promise response resolves to true.

formData

It is the form data in key/value pair.

pageNumber

For grouped forms, all the different form sections are paged from page number 1 to last page number. This argument returns the current page number of the section where onNext is called.

setErrors

It is a callback function which can be used for handling server side errors. Read more

Star us at github

© Copyright 2023 MuiForms