method

TextListField.Required

Require a nonempty list.

Example

go
field.TextList("tags").Required()

Arguments

ArgumentTypeDescription
values[]boolOmit the argument or pass true to require at least one item; pass false to make the field optional.

Returns

The updated TextListField; the original field is unchanged.

TextListField

How it works

Missing, null, and [] fail when required. A positive MinRows also requires items, even with Required(false).

Use MinLength(1) as well to reject empty strings inside the list.

Full signature

Related types

Related guides