method
MultiSelectField.DefaultFrom
Use a callback to choose the initial list of choice values when this field is omitted.
Arguments
| Argument | Type | Description |
|---|---|---|
callback | DefaultFunc[[]string] | A non-nil function that receives operation.DefaultContext and returns an operation.Value[[]string] plus an error. Return Present(value) to supply a value, Empty to supply no default, or an error to stop the operation. |
Returns
A new MultiSelectField with this callback as its only default. The original field is unchanged; this replaces any previous Default or DefaultFrom setting.
MultiSelectFieldHow it works
The callback runs on the server when omitted input is eligible for initialization. It does not prefill an unsaved form or refill a field on every edit. See the default values guide for new objects, repeated rows, and locales.
Return declared choice values, not display labels. An empty list is a supplied value; it must still pass selection limits.
Full signature
func (f MultiSelectField) DefaultFrom(
callback DefaultFunc[[]string],
) MultiSelectFieldRelated types
MultiSelectFieldMultiSelectField configures a field for choosing several values from a fixed list.
DefaultFuncChoose a field’s initial value on the server using the request, user, locale, or nearby values.