BelongsToSelect Default Value

Hey everyone!

I am trying to set a default value for a BelongsToSelect relationship field.

Here is what I have done:

Tables.belongsTo(models.tips, {
			foreignKey: {
				name: "tip3IdKey",
				field: "tip3Id",
				defaultValue: 5,
			},
			as: "tip 3",
		});

However, when I go to the creation page on Forest Admin I still have this “Select”

What I would like to do is that that field as a default value when opening the creation form, is that the default value is the tip having 5 as id.

Is there a way of doing so?

Thanks.

Hello @daweido,

I am sorry, but having a default value on a belongs to relationship is not supported at the moment.

I’ll share you feedback with the team to have this added.

Thank you for your patience.

1 Like