Developer Docs - Helix - Form Validation

The form validation logic below only works for inputs that are placed within <lava-form> tags.

This page covers client-side validation, but it's critical to also validate input on the server side. This ensures security even if your endpoints are accessed directly.

Form validation only applies to POST, PUT and DELETE calls. Validation is not processed on GET requests.

Validation Convention

Streamlining form validation is straightforward with the guidelines outlined below. Leverage the native HTML5 validation attributes to augment your input fields. In the event of a validation error, we'll show the validation message you provide. The message you would like to display will be read from a span with the id of rfv-{control id}. Rest assured, utilizing the Lava shortcodes for form fields automates this process for you.If you don't provide a validation message then the default HTML/JavaScript message will be shown.

Validation Summary

Validation Logic

The documentation below is not meant to be a full description of what is possible using the HTML validation API, but it provides the basic use cases for you. Note that if you use the Lava shortcodes these values will be provided for you. It's only when you are providing your own controls by calling the {[ rockcontrol ... ]} directly or by providing your own entire markup yourself that you need to worry about these fields.

HTML Validation Types

HTML5 introduced a range of input types that come with inherent validation logic, streamlining the process of ensuring that user-provided data conforms to expected formats or criteria. This feature enhances the user experience by providing immediate feedback on input errors, reducing the likelihood of incorrect data submission. Below is an explanation of how these input types incorporate built-in validation logic:

Validation Attributes

Several attributes are at your disposal to establish validation criteria for input elements. The following offers a succinct overview of their implementation.