This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Meysam
Meysam

In the fields.yaml definition file, I have a relation form widget to specify the language of the model:

language:
    label: Language
    nameFrom: title
    type: relation
    default: 2

I can set the default value of this dropdown to a specific language if I know its ID. For example, I know that the ID of the English language is 2, so I can set English as the default selected language by setting default: 2. But what if this ID changes to something else in the future? Is there any way to set the default value by title?

mjauvin
mjauvin

You can't in a relation type field. I suggest using a more flexible partial type field.

ref. https://octobercms.com/docs/backend/forms#field-partial

Last updated

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.