Validate & Error (must read)

Validation Information

Superform will perform validation in a step when it detects any of:

  • superform-validate attribute on an element or group of elements and/or

  • required attribute on an element or group of elements.

Attribute: superform-validate="identifier"

eg. superform-validate="name"

Marks the specified element for validation by Superform. The "identifier" value specifies the unique name of the input element to be validated. Superform will perform validation on this element based on the other validating attributes that the user adds. ✔ Can be paired with an error message - see below

Images: INPUT (text) with "NAME" identifier. It will be validated for MINIMUM CHARACTERS = 1

Error Message Information

Attribute: superform-error="identifier"

eg. superform-error="name"

Pairs an error message to the corresponding validating field and is shown during step validation.

MUST be the same "identifier" as the validating field.

example:

superform-validate = "name"

superform-error = "name"

Check which fields can be validated in the next sections.

Last updated