Lion Logo Lion Guides Components Docs Blog Toggle darkmode

Fieldset: Features

With Data

The fieldset's modelValue is an Object containing properties where the key is the name attribute of the field, and the value is the modelValue of the field.

Disabled

Disabling a fieldset disables all its child fields. When enabling a fieldset, fields that have disabled explicitly set will stay disabled.

Nesting fieldsets

Fieldsets can also be nested. The level of nesting will correspond one to one with the modelValue object.

Validation

You can create validators that work on a fieldset level. Below, we mimic a required validator, but on the fieldset. Try it by typing something in the input, then removing it.

Validating multiple inputs in a fieldset

You can have your fieldset validator take into consideration multiple fields.

Alternatively you can also let the fieldset validator be dependent on the error states of its child fields.

Simply loop over the formElements inside your Validator's execute method:

this.formElements.some(el => el.hasFeedbackFor.includes('error'));

Validating multiple fieldsets

You can have your fieldset validator take into accounts multiple nested fieldsets.